This file contains hidden or 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
declare namespace preact { | |
interface ComponentProps { | |
children?:JSX.Element[]; | |
key?:string; | |
} | |
interface PreactHTMLAttributes { | |
key?:string; | |
} |
This file contains hidden or 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
let Observable = Rx.Observable; | |
let div:Element = document.querySelector('.to-drag'); | |
let mousedown = Observable.fromEvent(div, 'mousedown'); | |
let mouseup = Observable.fromEvent(document, 'mouseup'); | |
let mousemove = Observable.fromEvent(document, 'mousemove'); | |
mousedown.forEach((e) => { | |
return mousemove |
This file contains hidden or 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
local random = math.random | |
local function uuid() | |
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' | |
return string.gsub(template, '[xy]', function (c) | |
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb) | |
return string.format('%x', v) | |
end) | |
end |
This file contains hidden or 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
urlencode() { | |
# urlencode <string> | |
old_lc_collate=$LC_COLLATE | |
LC_COLLATE=C | |
local length="${#1}" | |
for (( i = 0; i < length; i++ )); do | |
local c="${1:$i:1}" | |
case $c in |