Skip to content

Instantly share code, notes, and snippets.

View toastal's full-sized avatar
🗑️
Offer alt mirror so I can delete my account w/ MS GitHub finally

toastal

🗑️
Offer alt mirror so I can delete my account w/ MS GitHub finally
View GitHub Profile
@toastal
toastal / admonition.adoc
Last active August 15, 2023 05:25
I am an admonition on GitHub via AsciiDoc & reStructuredText
Note
this is just an admonition
Warning
It is your choice

You are not required to use GitHub

this

Note

Should be a note. But does Microsoft GitHub render it properly?

@toastal
toastal / thai-admonition.adoc
Last active June 27, 2022 03:04
thai-admonition.adoc

Test AsciiDoc ภาษาไทย

var str1 = '0100100001100101011011000110110001101111001000000101011101101111011100100110110001100100';
var str2 = '0111000001101100011001010110000101110011011001010010000001110100011000010110110001101011001000000111010001101111001000000110110101100101';
var str3 = '011011000110100101100110011001010010000001110010011010010110011101101000011101000010000001101110011011110111011100100000011010010111001100100000011011000110111101101110011001010110110001111001';
var binStr2ASCII = (str) => {
return str.match(/[01]{8}/g).map(x => String.fromCharCode(parseInt(x, 2))).join('');
};
var testStrs = [str1, str2, str3];
@toastal
toastal / urlParser.js
Last active October 18, 2021 08:16
Ramda URL Parser
// requires Ramda (http://ramdajs.com/)
// urlParser : String -> Object
;urlParser = (function(document, R) {
"use strict";
const {fromPairs, pipe, reduce, replace, split} = R;
let parser = document.createElement("a");
// searchToKeyVal : String -> Object
@toastal
toastal / .vimrc
Last active October 18, 2021 08:15
if !1 | finish | endif
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
;; User behaviors
;; -----------------------------
;; Behaviors are stored as a set of diffs that are merged together
;; to create the final set of functionality that makes up Light Table. You can
;; modify these diffs to either add or subtract functionality.
;;
;; Behaviors are added to tags, objects with those tags then automatically gain
;; whatever logic the behavior imparts. To see a list of user-level behaviors,
;; start typing a word related to the functionality you want in between the square
;; brackets (e.g. "theme").
# Prefix to Ctrl-a like `screen`
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
# Mouse works as expected
@toastal
toastal / recursive-multisort.js
Last active October 18, 2021 08:11
Recursive Mulitsort
let data =
[ [{value: 0}, {value: 3}, {value: "c"}]
, [{value: 2}, {value: 1}, {value: "a"}]
, [{value: 1}, {value: 2}, {value: "b"}]
, [{value: 1}, {value: 3}, {value: "b"}]
];
let sorter = [[1, false], [2, false]];
@toastal
toastal / tail-recursive-closest.js
Last active October 18, 2021 08:09
Tail-Recursive `Element.prototype.closest` Polyfill
/*
* Element.matches()
* https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
* The Element.matches() method returns true if the element would be selected
* by the specified selector string; otherwise, returns false.
*
* Prefixed Support: Android 2.2, Internet Explorer 9, Edge 12, Safari 5.0
* Unprefixed Support: Chrome 34, Firefox 34, Safari 7.1, iOS Safari 8.0
*/