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
type TypedDispatcher<R> = R extends (state: any, payload?: infer P, meta?: infer M) => any | |
? (payload?: P, meta?: M) => Action<P, M> | |
: R extends (state: any, payload: infer P, meta?: infer M) => any | |
? (payload: P, meta?: M) => Action<P, M> | |
: R extends (state: any, payload: infer P, meta: infer M) => any | |
? (payload: P, meta: M) => Action<P, M> | |
: null; | |
type StripUnknown<T> = T extends (payload?: unknown, meta?: unknown) => Action<unknown, unknown> | |
? () => Action<never, never> |
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
const St = imports.gi.St; | |
const Main = imports.ui.main; | |
const Shell = imports.gi.Shell; | |
const Clipboard = St.Clipboard.get_default(); | |
const CLIPBOARD_TYPE = St.ClipboardType.CLIPBOARD; | |
const namespace = 'cuid'; | |
const blockSize = 4; | |
const base = 36; |
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
const Destroyable = (superclass, destroyTimeout) => class extends superclass { | |
detachedCallback() {this.__destroying = setTimeout(() => { if (!this.isConnected && this.destroyedCallback) this.destroyedCallback() }, destroyTimeout)}, | |
attachedCallback() {clearTimeout(this.__destroying)} | |
}; |
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
function buildPatterns(order) { | |
let orderMap = {}; | |
let orderArray = order.split("|"); | |
orderArray.forEach((t, i) => orderMap[ t ] = i); | |
return (consts, ...vars) => { | |
const escapePars = [ /(\(|\))/g, "\\$1" ]; | |
const map = { | |
number: { match: `([\\de.-]+)`, cast: Number }, | |
string: { match: `([\\w.-]+)`, cast: String }, |
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
const mediator = new WeakMap(); | |
const notify = (instance, ev, index, item) => mediator.get(instance)[ev].forEach(listener => listener({index, item})); | |
class OArray extends Array { | |
constructor() { | |
super(); | |
mediator.set(this, {changed: [], added: [], removed: []}); | |
} | |
push(...items) { | |
for (let i = 0, tl = this.length, l = items.length; i < l; i++) { | |
let item = items[i]; |
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
location ~/html-imports/(.+)$ { | |
set $path $1; | |
default_type 'text/html'; | |
content_by_lua 'ngx.say("<script src=\'", ngx.var.path, ".js\'></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
Object.prototype.getPath = function(path) { | |
return path | |
.split(".") | |
.reduce((obj, p) => obj ? obj[p] : undefined, this); | |
} | |
Object.prototype.setPath = function(path) { | |
return path | |
.split(".") | |
.reduce((obj, p) => typeof obj[p] === 'object' ? obj[p] : (obj[p] = {}), this); |
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
(function (global) { | |
var dynamicFunctionsNames = {}; | |
var cached = {}; | |
function expressBinding(match, p) { | |
var fun; | |
var attrs = p | |
.replace(/&/g, "&") // decode & | |
.replace(/</g, "<") // decode < | |
.replace(/>/g, ">") // decode > |