- Python >=3.5 (compiled with sqlite3 support)
- That’s it.
- This may have been a bad idea.
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
<html> | |
<body> | |
<script> | |
'use strict'; | |
ArrayBuffer.prototype.toSource = function(hex) { | |
var buf = this, | |
bytes = Array.prototype.slice.call(new Uint8Array(buf)), | |
i = buf.byteLength, | |
blank = true; |
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
import dis | |
import inspect | |
class MethodMissingMixin: | |
def __getattr__(self, attr): | |
if hasattr(getattr(self, '__methodmissing__', None), '__call__'): | |
parent_frame = inspect.currentframe().f_back | |
instructions = dis.get_instructions(parent_frame.f_code) | |
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 splatify(func) { | |
args_string = func.toString().split('(')[1].split(')')[0].split(',').map(function(s) { return s.trim(); }); | |
if (args_string.length && args_string[args_string.length - 1] === 'splat_args') { | |
pivot = args_string.length - 1; | |
return function () { | |
if (arguments.length > pivot + 1) { | |
args = Array.prototype.slice.call(arguments, 0, pivot); | |
args.push(Array.prototype.slice.call(arguments, pivot)); |
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
import os | |
from http.client import HTTPSConnection | |
from time import sleep | |
def request(): | |
connection = HTTPSConnection('httpbin.org') | |
connection.request('GET', '/headers') | |
return connection.getresponse().read() |
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
var slice_re = new RegExp(/^(.*?)\[(-?\d*?)(:?)(-?\d*?)(:?)(-?\d*?)\]$/); | |
function xpath(path, objects) { | |
var selectors, selector, is_array_selector, array_components, array_components_length, array_rules, j, i, is_regex_selector, tail_path, objects_length, heap, object, matches, key, matches_length, match, array_start, array_end, array_interval, _, k; | |
if (!Array.isArray(objects)) { | |
objects = [objects]; | |
} | |
selectors = path.split('.'); |
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
<html> | |
<head> | |
<style> | |
#left, #right, #test { | |
display: block; | |
z-index: 0; | |
} | |
#left { | |
float: left; |
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 pack = s => | |
s.match(/^[\u0000-\u00ff]*$/) | |
? s | |
.split("") | |
.map(s => s.charCodeAt()) | |
.reduce( | |
(pairs, c) => | |
( | |
!c || pairs[pairs.length - 1].length === 2 | |
? pairs.push(...(c? [[c]] : [[c], []])) |
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 type Formatters = { [k: string]: (s: string) => string }; | |
export class FormatError extends Error { | |
constructor( | |
public message: string, | |
public str: string, | |
public formatters: Formatters, | |
public tag: string | |
) { | |
super(); |
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 type StringReturningFunction = (...args: any[]) => string; | |
interface LazyString extends String {} | |
interface LazyStringConstructor { | |
new <F extends StringReturningFunction>( | |
func: F, | |
...args: Parameters<F> | |
): LazyString; | |
<F extends StringReturningFunction>(func: F, ...args: Parameters<F>): string; |