Skip to content

Instantly share code, notes, and snippets.

Avatar

Henner R Setyono hrsetyono

View GitHub Profile
@hrsetyono
hrsetyono / guide.md
Last active May 14, 2021
Folder Management in Windows with CLI
View guide.md

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 Jan 2, 2021
Clone Private Github repo to Digital Ocean (with Password)
View README.md

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
View surprised-pikachu.jpg
⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⣠⣤⣶⣶
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⢰⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⣀⣾⣿⣿⣿⣿
⣿⣿⣿⣿⣿⡏⠉⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿
⣿⣿⣿⣿⣿⣿⠀⠀⠀⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠁⠀⣿
⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠙⠿⠿⠿⠻⠿⠿⠟⠿⠛⠉⠀⠀⠀⠀⠀⣸⣿
⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⣴⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⢰⣹⡆⠀⠀⠀⠀⠀⠀⣭⣷⠀⠀⠀⠸⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠈⠉⠀⠀⠤⠄⠀⠀⠀⠉⠁⠀⠀⠀⠀⢿⣿⣿⣿
View timber.php
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 Jul 11, 2019
JavaScript - Create one letter favicon dynamically
View app.js
/**
* 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 Nov 15, 2018
Sass - Mixin to create functional classes from a Map
View functional-classes-loop.scss
$_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 Oct 31, 2018
Start animation on scroll
View animate-on-scroll.css
[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 Jul 2, 2018
PHP Google Calendar API with Service Accounts
View functions.php
<?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 Oct 3, 2020
FEH Tasker - GHB auto battle lunatic
View tasker.xml
<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"/>
@hrsetyono
hrsetyono / elegantt-bug.log
Created Sep 14, 2017
Chrome log when Elegantt "wrapping timeline" happens
View elegantt-bug.log
This file has been truncated, but you can view the full file.
chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/angular/angular.min.js:2 TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/angular/angular.min.js:1:387
at m.$digest (chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/angular/angular.min.js:2:28280)
at m.$apply (chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/angular/angular.min.js:2:29408)
at chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/angular/angular.min.js:3:3803
at g (chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/angular/angular.min.js:1:17445)
at chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/angular/angular.min.js:1:19539
at c (chrome-extension://jdongfcbejkjibhkbekkjcckophhjcjj/vendors/raven-js/dist/raven.js:1:3893) undefined