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
/** | |
* ChoiceSet is a weighted random solution that allows the each of the | |
* items that are being chosen to have simply a name or full suite of | |
* values other than their weights and names. | |
* | |
* Once the items have been setup with a name and weight, the system works | |
* by creating a one to one array. Each item in the new array is a sum of | |
* all the subsequent and current weights. The final weight, being the | |
* maximum total weight, is also stored. | |
* |
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
#!/usr/bin/env node --harmony | |
// Fetch the Path, File System and Child Process modules | |
var Path = require('path'); | |
var FS = require('fs'); | |
var CP = require('child_process'); | |
/** | |
* The actual webpack config is stored within a function and then | |
* extracted as a string as this preserves the regular expression |
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
/** | |
* A small helper for multiline template strings that allows you to | |
* not worry about new lines and indentations within your code from | |
* breaking up the format of the string. | |
* | |
* @param {Array} strings an array of Strings from the template, broken up by | |
* where the substitions are to be inserted. | |
* @param {Array} values an array of values to be inserted after each string | |
* of a matching index. | |
* @return {String} a template String without any prefixed or postfixed tabs |
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
<div class="progress p0"> | |
<div class="bar"> | |
<div class="slice slice1"></div> | |
<div class="slice slice2"></div> | |
<div class="slice sliceN"></div> | |
<div class="slice slice3"></div> | |
<div class="slice slice4"></div> | |
<div class="slice slice5"></div> | |
</div> | |
<div class="track"> |
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
#include <sys/types.h> | |
#include <arpa/inet.h> | |
#include <ifaddrs.h> | |
#include <libgen.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> |
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
// ES5 | |
/** | |
* The Code "class" defines an object that represents a source code with | |
* a history of changes. Whenever its source property is assigned, the | |
* new value is pushed onto a stack of code. Whenever its source property | |
* is read, the latest iteration of the code is returned as a string. | |
* | |
* @method Code | |
* |
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
# Encryption and decryption BASH functions using openssl | |
function decrypt() { | |
# The first param doesn't contain .enc, write output plus .decrypted if no 2nd | |
if [ "${1/.enc/}" = "${1}" -a -e "${1}" ]; then | |
openssl enc -d -aes-256-cbc -in "${1}" -out "${2:-${1}.decrypted}" | |
# The first param contains .enc, write the output without if no 2nd param | |
elif [ "${1/.enc/}" != "${1}" -a -e "${1}" ]; then | |
openssl enc -d -aes-256-cbc -in "${1}" -out "${2:-${1/.enc/}}" |
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
// Patch Function.prototype to provide the signature in the REPL | |
Object.defineProperty( | |
Function.prototype, | |
'signature', | |
{ | |
get() { | |
let source = this.toString() | |
// For classes we need to extract the signature of the | |
// constructor function within; so use some regular |
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
rem see https://github.com/coreybutler/nvm-windows/issues/300 | |
@echo off | |
SETLOCAL EnableDelayedExpansion | |
if [%1] == [] ( | |
echo Pass in the version you would like to install, or "latest" to install the latest npm version. | |
) else ( | |
set wanted_version=%1 |
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
/** | |
* If the value supplied is actually a number, basically finite values that | |
* can be parsed as floats and are not `NaN` will cause this function to | |
* return true | |
* | |
* @param {mixed} value any value that should be tested for numberhood | |
* | |
* @return {Boolean} true if the value is not `NaN` and can be parsed as | |
* a float | |
*/ |