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
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
) |
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
server { | |
listen 80; | |
server_name ~^(?<instance>.+?)\.foo.example.com$; | |
set $instance_root /instances/$instance.foo.example.com; | |
set $htaccess_user_file /htaccess/$instance.foo.example.com.htaccess; | |
root $instance_root; | |
# Abusing unused error codes to perform an internal redirect |
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
app.directive 'chartScatterplot', (Utils, Stats) -> | |
restrict: 'E' | |
scope: | |
model: '=' | |
class: '@' | |
aggregate: '=' | |
showOutliers: '=' |
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
server { | |
listen 80; | |
server_name *.foo.example.com; | |
# We need this to resolve the host, because it's a wildcard. | |
# This is google's DNS server. | |
resolver 8.8.8.8; | |
include /etc/nginx/includes/proxy.conf; |
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
;(function() { | |
var mergesort = (function() { | |
function merge(leftArray, rightArray) { | |
if ((leftArray || []).length < 1) return rightArray; | |
if ((rightArray || []).length < 1) return leftArray; | |
var leftIndex = 0 | |
, rightIndex = 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
### | |
An quick way to add custom shaders to blocks: | |
<shader shader-vertex="/path/to/shader.vert" shader-fragment="/path/to/shader.frag">...</shader> | |
### | |
app.directive 'shader', -> | |
restrict: 'EA' | |
replace: true | |
transclude: true |
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
// Ex. | |
// fib = new FibonacciGenerator(); | |
// for (var i = 0; i < 10; i++) | |
// console.log( fib.next() ); | |
var FibonacciGenerator = function(prev, curr) { | |
var prev = parseInt(prev) || 0 | |
, curr = parseInt(curr) || 1; | |
var next = function(oldPrev, oldCurr) { |
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
#!/bin/sh | |
# http://wiki.nginx.org/Faq#How_do_I_generate_an_htpasswd_file_without_having_Apache_tools_installed.3F | |
PASSWORD=$1; | |
SALT="$(openssl rand -base64 3)" | |
SHA1=$(printf "$PASSWORD$SALT" | openssl dgst -binary -sha1 | sed 's#$#'"$SALT"'#' | base64); | |
printf "{SSHA}$SHA1\n" |
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
# Enumerate, python-style | |
enumerate = (list) -> | |
index = 0 | |
list.map (item) -> [index++, item] | |
for [index, item] in enumerate(['bacon','sauce']) | |
console.log index, item |