This file contains hidden or 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
| // Call the function with at least one parameter. | |
| // The last parameter must be a function that will run on it's own thread | |
| // Any params that are passed to Thread() will be available in the thread function | |
| // The last param of the thread function must be | |
| function Thread(){ | |
| return new Promise((resolve, reject)=>{ | |
| var args = Array.from(arguments); | |
| var func = args.pop(); |
This file contains hidden or 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
| <?php | |
| $here = realpath(dirname(__FILE__)); | |
| $handle = fopen("$here/wordlist.txt", "r") or die("Couldn't get handle"); | |
| $matches = levenshteinMatches($handle, $_GET['word']); | |
| echo "<pre>"; | |
| print_r($matches); |
This file contains hidden or 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
| <?php | |
| /** | |
| * Run a command with optional stdin | |
| * @param string $cmd - the command to run | |
| * @param string|string[] $stdin - the stdin to feed to the command | |
| * @param string $cwd - the working directory in which to run the command | |
| * @return object containing exit_status, stdout, stderr and elapsed | |
| */ | |
| function runcmd($cmd, $stdin=null, $cwd=null){ |
This file contains hidden or 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
| <?php | |
| $text = "Your Text Here | |
| this is a test of the things and stuff and things"; | |
| $font_size = "12"; | |
| $color = "#000000"; | |
| $font_file = "/Applications/XAMPP/xamppfiles/htdocs/otcb/app/fonts/OldStreetSigns.ttf"; | |
| $background = "#FFFFFF"; | |
| $wrap_width = "250"; | |
| $alpha = 0; |
This file contains hidden or 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
| // GET request with data, JSON response | |
| function getJson(url, params={}){ | |
| var url = new URL(url); | |
| Object.keys(params).forEach(key => url.searchParams.append(key, params[key])) | |
| return fetch(url) | |
| .then(res=>res.json()) | |
| } | |
| function getText(url, params={}){ |
This file contains hidden or 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
| // This is 3 different files concatted for simplicity. | |
| // USAGE: | |
| // use in browser or via node to generate the checksum | |
| var files = [ | |
| 'listFiles.js', | |
| 'md5.js', | |
| 'private.properties', | |
| 'project.properties', | |
| 'project.xml', |
This file contains hidden or 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
| <?php | |
| // https://3v4l.org/ZcDnE | |
| /** | |
| * compare 2 data structures. | |
| * - Doesn't handle things like NaN that don't compare. | |
| * - returns true if $b has all the same properties as $a and all properties have same values. | |
| */ | |
| function deepCompare($a, $b){ |
This file contains hidden or 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
| // http://jsfiddle.net/eLbznqx0/ | |
| class Color { | |
| constructor(rgb) { | |
| this.rgb = rgb; | |
| this.colormap = { | |
| "110": "yellow", | |
| "101": "magenta", | |
| "011": "cyan", | |
| "100": "red", |
This file contains hidden or 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 path = require("path"); | |
| const fs = require("fs"); | |
| /** | |
| * Find the lowest level parent directory with a | |
| * node_modules directory and a package.json | |
| * @returns {String|false} | |
| */ | |
| function find_root_project(){ |
This file contains hidden or 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
| <?php | |
| /** | |
| * JSON Web Tokens (RFC 7519) | |
| * The smallest, simplest possible JWT class. | |
| * | |
| * This version is updated to not use openssl or hash_encrypt for use on an | |
| * older system. If possible use the one linked below instead. Usage is the same. | |
| * | |
| * https://github.com/Pamblam/tinyJWT |