Skip to content

Instantly share code, notes, and snippets.

View hrsetyono's full-sized avatar

Henner Renardi Setyono hrsetyono

View GitHub Profile
@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';
@hrsetyono
hrsetyono / tasker.xml
Last active October 3, 2020 18:25
FEH Tasker - GHB auto battle lunatic
<TaskerData sr="" dvi="1" tv="5.1m">
<Task sr="task2">
<cdate>1523392871013</cdate>
<edate>1523447950219</edate>
<id>2</id>
<nme>LNavarre</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>