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
/* | |
* Tiny tokenizer | |
* | |
* - Accepts a subject string and an object of regular expressions for parsing | |
* - Returns an array of token objects | |
* | |
* tokenize('this is text.', { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ }, 'invalid'); | |
* result => [{ token="this", type="word" },{ token=" ", type="whitespace" }, Object { token="is", type="word" }, ... ] | |
* | |
*/ |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
#!/usr/bin/env python | |
"""Command line script to convert a file, usually an image, into a data URI | |
for use on the web.""" | |
import base64 | |
import mimetypes | |
import os | |
import sys | |
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() { | |
var buildMap = {}; | |
/* RequireJS Use Plugin v0.2.0 | |
* Copyright 2012, Tim Branyen (@tbranyen) | |
* use.js may be freely distributed under the MIT license. | |
*/ | |
define({ | |
version: "0.2.0", |
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
def distinct(iterable, keyfunc=None): | |
seen = set() | |
for item in iterable: | |
key = item if keyfunc is None else keyfunc(item) | |
if key not in seen: | |
seen.add(key) | |
yield item | |
if __name__ == '__main__': | |
x = [0, 0, 1, 0, 1, 2, 2, 1, 0] |
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
// NOTICE 2020-04-18 | |
// Please see the comments below about why this is not a great PRNG. | |
// Read summary by @bryc here: | |
// https://github.com/bryc/code/blob/master/jshash/PRNGs.md | |
// Have a look at js-arbit which uses Alea: | |
// https://github.com/blixt/js-arbit | |
/** |