Skip to content

Instantly share code, notes, and snippets.

View rendfall's full-sized avatar
💭
Coffee is a drink, not a language! ☕️

rendfall rendfall

💭
Coffee is a drink, not a language! ☕️
View GitHub Profile
@rendfall
rendfall / grep-repo.sh
Created April 14, 2021 10:05
Grep repository through all revisions
git rev-list --all | (
while read revision; do
git grep -F 'phrase' $revision
done
)
@rendfall
rendfall / phaser-keypress-handler.js
Last active January 2, 2020 17:17
Phaser - handle keypress input event
// Phaser.Scene context
const keys = new Set();
this.input.keyboard.on('keydown', (event) => {
if (keys.has(event.code)) {
return
}
keys.add(event.code);
@rendfall
rendfall / make-request-while-example.ts
Last active August 9, 2019 17:42
[RxJS] Retry HTTP request as long as response status is PENDING (1)
import { makeRequestWhile } from './make-request-while'
const MOCKED_API = {
PENDING: 'https://www.mocky.io/v2/5d4db060330000254b33796a',
SUCCESS: 'https://www.mocky.io/v2/5d4db057330000d43f337969',
ERROR: 'https://www.mocky.io/v2/5d4db0463300004b44337968',
}
const STATUSES = {
PENDING: 1,
@rendfall
rendfall / convert-mp4-to-mp3.bat
Created April 8, 2019 22:08
Batch script to convert mp4 files to mp3
echo off
for %%a in ("./source/*.mp4") do ffmpeg -i "%%a" -b:a 320K -vn "./output/%%a.mp3"
pause
@rendfall
rendfall / 1.js
Created January 27, 2019 14:35 — forked from chrisbuttery/1.js
Fade in / Fade out
// fade out
function fade(el) {
var op = 1;
var timer = setInterval(function () {
if (op <= 0.1){
clearInterval(timer);
el.style.display = 'none';
}
el.style.opacity = op;
@rendfall
rendfall / animation-loop.js
Created January 23, 2019 22:10
Animation Loop
class AnimationLoop {
constructor(fps = 24) {
this.updateFn = null;
this.id = 0;
this.setFps(fps);
}
onUpdate(fn) {
this.updateFn = fn;
}
@rendfall
rendfall / multiple_ssh_setting.md
Created December 13, 2018 11:55
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@rendfall
rendfall / addDelayedEventListener.js
Created September 7, 2018 17:15
Delayed event listener
function addDelayedEventListener($el, eventName, action) {
const listener = async function (event) {
$el.removeEventListener(eventName, listener);
$el.disabled = true;
await action.call(action, event);
$el.disabled = false;
addDelayedEventListener($el, eventName, action);
};
@rendfall
rendfall / random-word.sh
Created June 17, 2018 13:13
Random 4-letter word from the dictionary
# Random 4-letter word from the dictionary
$ shuf -n4 /usr/share/dict/words | tr -d '\n'
@rendfall
rendfall / blob-to-json.js
Created March 18, 2018 22:10
BLOB saving as JSON
// https://jsfiddle.net/koldev/cW7W5/
var saveData = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (data, fileName) {
var json = JSON.stringify(data),
blob = new Blob([json], {type: "octet/stream"}),
url = window.URL.createObjectURL(blob);
a.href = url;