Skip to content

Instantly share code, notes, and snippets.

View KaMeHb-UA's full-sized avatar
🇺🇦
working from Ukraine, for Ukraine

KaMeHb-UA

🇺🇦
working from Ukraine, for Ukraine
  • Ukraine
  • 21:33 (UTC +03:00)
View GitHub Profile
@cdown
cdown / gist:1163649
Last active July 25, 2024 03:11
Bash urlencode and urldecode
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
@jrus
jrus / lua-uuid.lua
Created July 29, 2012 09:26
quick lua implementation of "random" UUID
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
@HenriqueLimas
HenriqueLimas / dropdown.js
Created May 3, 2016 12:36
Dropdown with RxJs
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
declare namespace preact {
interface ComponentProps {
children?:JSX.Element[];
key?:string;
}
interface PreactHTMLAttributes {
key?:string;
}