Skip to content

Instantly share code, notes, and snippets.

View celmaun's full-sized avatar
🏠
Working from home

Celmaun celmaun

🏠
Working from home
  • Remote
View GitHub Profile
@celmaun
celmaun / deferred_promise.js
Created April 25, 2021 09:59 — forked from oliverfoster/deferred_promise.js
Deferred promise
class DeferredPromise extends Promise {
constructor(def = (res, rej)=>{}) {
let res, rej;
super((resolve, reject)=>{
def(resolve, reject);
res = resolve;
rej = reject;
});
this.resolve = res;
@celmaun
celmaun / generate-client.sh
Created April 23, 2021 01:29 — forked from Belphemur/generate-client.sh
Generate a new client configuration for WireGuard
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "$0 client-name"
exit 1
fi
@celmaun
celmaun / unit.sh
Created February 18, 2021 22:16 — forked from tvlooy/unit.sh
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else
(function(w, d, undefined){
if( w.onfocusin === undefined){
d.addEventListener('focus', addPolyfill, true);
d.addEventListener('blur', addPolyfill, true);
d.addEventListener('focusin', removePolyfill, true);
d.addEventListener('focusout', removePolyfill, true);
}
function addPolyfill(e){
var type = e.type === 'focus' ? 'focusin' : 'focusout';
@celmaun
celmaun / README.md
Created November 17, 2012 15:42 — forked from mbostock/.block
Line Chart