This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function formRequest(method, action, body) { | |
event.preventDefault(); | |
fetch(action, { method, body }) | |
.then(res => res.redirected ? location.href = res.url : res.text()) | |
.then(document.write.bind(document)); | |
} | |
const PUT = form => formRequest("PUT", form.action, new FormjData(form)); | |
const DELETE = form => formRequest("DELETE", form.action); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
"sync" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (tokenize script-text) | |
(let ((tkns (list "")) (in-str? #f)) | |
(define (append-str! str) | |
(set-car! tkns (string-append (car tkns) str))) | |
(define (add-tkn! . strs) | |
(if (string=? (car tkns) "") (set! tkns (cdr tkns))) | |
(set! tkns (append (reverse strs) tkns))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'a abbr address area article aside audio b base bdi bdo blockquote body br \ | |
button canvas caption cite code col colgroup data datalist dd del details dfn \ | |
dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 \ | |
h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li \ | |
link main map mark math menu meta meter nav noscript object ol optgroup option \ | |
output p param picture pre progress q rp rt ruby s samp script section select \ | |
slot small source span strong style sub summary sup svg table tbody td \ | |
template textarea tfoot th thead time title tr track u ul var video wbr \ | |
'.split(' ').forEach(tag => window[tag] = (...args) => { | |
const el = Object.assign(document.createElement(tag), ...args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function useDebounce(handler: (value: string) => void, millisec: number = 500) { | |
const [value, setValue] = useState(''); | |
useEffect(() => { | |
const timeoutId = setTimeout(() => handler(value), millisec); | |
return () => clearTimeout(timeoutId); | |
}, [value, handler, millisec]); | |
return setValue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- takes all | |
love = { | |
audio = { | |
getActiveEffects = function(...) end, --Gets a list of the names of the currently enabled effects. | |
getActiveSourceCount = function(...) end, --Gets the current number of simultaneously playing sources. | |
getDistanceModel = function(...) end, --Returns the distance attenuation model. | |
getDopplerScale = function(...) end, --Gets the global scale factor for doppler effects. | |
getEffect = function(...) end, --Gets the settings associated with an effect. | |
getMaxSceneEffects = function(...) end, --Gets the maximum number of active effects. | |
getMaxSourceEffects = function(...) end, --Gets the maximum number of active Effects for each Source. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xmodmap -e "keycode 49 = apostrophe quotedbl bar bar bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add these lines in .bashrc and set Raspberry Pi to auto login | |
if [ ! -f /tmp/fluidsynth-bootloaded ]; then | |
touch /tmp/fluidsynth-bootloaded | |
killall fluidsynth | |
fluidsynth -a alsa -g 1 /usr/share/sounds/sf2/default-GM.sf2 -o midi.autoconnect=1 -c 4 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Constant Amortization System for HP12C (Platinum) | |
// Author: Henrique Gogó (henriquegogo@gmail.com) | |
// | |
// Instructions: enter n, i and PV values and set FV as 0. | |
// Set register 9 if you want to get an specific payment number. | |
// | |
// After program ends, the result saved in registers will be: | |
// X: current payment value | |
// FV: remaining amount to pay | |
// PMT: amortization value (fixed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qemu-img create -f qcow2 "$@" 80G |
NewerOlder