Skip to content

Instantly share code, notes, and snippets.

View hrsetyono's full-sized avatar

Henner Renardi Setyono hrsetyono

View GitHub Profile
<!-- wp:group {"tagName":"header","backgroundColor":"main","textColor":"white","layout":{"type":"constrained"},"anchor":"summer-camps"} -->
<header class="wp-block-group alignfull has-white-color has-main-background-color has-text-color has-background" id="summer-camps"><!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"main-alt"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-main-alt-background-color has-background wp-element-button">6 Villes Disponibles</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
<!-- wp:heading {"textAlign":"center","level":1,"textColor":"sub","anchor":""} -->
<h1 class="wp-block-heading has-text-align-center has-sub-color has-text-color">CAMP D'ÉTÉ EN ASIE</h1>
<!-- /wp:heading -->
@hrsetyono
hrsetyono / package.json
Last active July 10, 2022 16:58
Vite for WordPress (work in progress, hot reload not yet working)
{
"name": "my-app",
"private": true,
"repository": {
"type": "git",
"url": "git+https://github.com/username/my-app"
},
"dependencies": {},
"devDependencies": {
"sass": "^1.53.0",
@hrsetyono
hrsetyono / guide.md
Last active May 14, 2021 06:18
Folder Management in Windows with CLI

Remove all empty directories

for /f "delims=" %d in ('dir /s /b /ad ^| sort /r') do rd "%d"

7Zip - Compress each directories into its own zip

Require 7zip installation to be added to PATH

@hrsetyono
hrsetyono / README.md
Created January 2, 2021 03:36
Clone Private Github repo to Digital Ocean (with Password)

Warning: This only works if you enable Password authentication in Digital Ocean.

If you want to use Key authentication, most tutorials in Google already cover that.

Step 1 - Create deploy.yml

In your repo, create .github/workflow/deploy.yml containing this:

name: Deploy via SSH
⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⣠⣤⣶⣶
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⢰⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⣀⣾⣿⣿⣿⣿
⣿⣿⣿⣿⣿⡏⠉⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿
⣿⣿⣿⣿⣿⣿⠀⠀⠀⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠁⠀⣿
⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠙⠿⠿⠿⠻⠿⠿⠟⠿⠛⠉⠀⠀⠀⠀⠀⣸⣿
⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⣴⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⢰⣹⡆⠀⠀⠀⠀⠀⠀⣭⣷⠀⠀⠀⠸⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠈⠉⠀⠀⠤⠄⠀⠀⠀⠉⠁⠀⠀⠀⠀⢿⣿⣿⣿
class MyTimber extends TimberSite {
function __construct() {
add_filter( 'timber_context', [$this, 'add_to_context'] );
add_filter( 'get_twig', [$this, 'add_to_twig'] );
parent::__construct();
}
// Add Global variable
function add_to_context( $context ) {
@hrsetyono
hrsetyono / app.js
Last active July 11, 2019 08:43
JavaScript - Create one letter favicon dynamically
/**
* Automatically generate favicon using the first letter of a text
*/
function createFavicon( text, bgColor = '#004ea2', textColor = '#ffffff' ) {
var favicon = document.getElementById('favicon');
var faviconSize = 128;
var canvas = document.createElement( 'canvas' );
canvas.width = faviconSize;
canvas.height = faviconSize;
@hrsetyono
hrsetyono / functional-classes-loop.scss
Last active November 15, 2018 09:01
Sass - Mixin to create functional classes from a Map
$_name: null !global;
$_value: null !global;
// Custom loop to apply the name and value
@mixin _loop( $list, $responsive: true ) {
@each $name, $value in $list {
$_name: $name !global;
$_value: $value !global;
@content;
@hrsetyono
hrsetyono / animate-on-scroll.css
Last active October 31, 2018 09:50
Start animation on scroll
[data-animate] { visibility: hidden !important; }
.animate { visibility: visible !important; animation-duration: 1s; animation-fill-mode: both; }
.animate.fadeIn { animation-name: fadeIn; }
@keyframes ( fadeIn ) {
0% { opacity: 0; }
100% { opacity: 1; }
}
@hrsetyono
hrsetyono / functions.php
Last active July 2, 2018 03:19
PHP Google Calendar API with Service Accounts
<?php
/*
IMPORTANT!
If you came here from my WP Plugin (https://github.com/hrsetyono/google-calendar-api), you don't need to require the API Client.
Aside from that, you need to download the client from https://github.com/google/google-api-php-client/releases
Put it in this directory, then uncomment the require_once code below.
*/
// require_once 'vendor/autoload.php';