#!/usr/bin/env bash
# Assuming OS X Yosemite 10.10.4
# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
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
/* | |
~~ Snowball Poem ~~ | |
Snowball (also called a Chaterism): A poem in which each line is a single word, | |
and each successive word is one letter longer. One of the constrained writing | |
techniques invented by the Oulipo (Workshop of Potential Literature). | |
~~ Program Description ~~ | |
This program takes input from the file "input-raw.txt". It examines the file for |
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 uuid5(data) { | |
var out = crypto.createHash('sha1').update(data).digest(); | |
out[8] = out[8] & 0x3f | 0xa0; // set variant | |
out[6] = out[6] & 0x0f | 0x50; // set version | |
var hex = out.toString('hex', 0, 16); | |
return [ | |
hex.substring( 0, 8), |
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 ~* "^(.+)-[0-9a-f]{32}(\.(.*))$" { | |
try_files $uri $1$2 =404; | |
} |
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
/** | |
* Event handler to prevent richtext and linebreaks in contentEditable DIVs | |
*/ | |
$('body').on('keydown paste', 'div.editfield', function(e) { | |
var $field = $(e.currentTarget); | |
if (e.keyCode===13 && $field.hasClass('multiline')) { | |
return true; | |
} else if (e.keyCode===13 || e.type==='paste') { | |
setTimeout(function() { | |
$field.html($field.text()); |
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
/** | |
* Make a X-Domain request to url and callback. | |
* | |
* @param url {String} | |
* @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.) | |
* @param data {String} request body | |
* @param callback {Function} to callback on completion | |
* @param errback {Function} to callback on error | |
*/ | |
function xdr(url, method, data, callback, errback) { |
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
#!/bin/bash | |
current_dir=`pwd`/ | |
dir=$current_dir | |
usage="Usage : `basename $0` [-d dir] [-h] args\nWhere args are directories that you don't whant to pull" | |
while getopts hd: opt; do | |
case $opt in | |
d) | |
if [ ! -d "$OPTARG" ] ; then |
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 iterable = function* (obj) { | |
yield* Object.keys(obj).map(key => [key, obj[key]]); | |
}; |
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
/** | |
* Perform a throwing expression, and throw a custom error in case the expression threw | |
* | |
* - parameter expression: The expression to execute | |
* - parameter error: The custom error to throw instead of the expression's error | |
* - throws: The given error | |
* - returns: The return value of the given expression | |
*/ | |
func perform<T>(_ expression: @autoclosure () throws -> T, orThrow errorExpression: @autoclosure () -> Error) throws -> T { | |
do { |
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
#include <vector> | |
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
#define EPSILON 1.0e-5 | |
#define RESOLUTION 32 | |
class Point2D |
OlderNewer