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
import sys | |
from functools import cmp_to_key | |
def p(data, label=None): | |
if label: | |
print(label, end=": ", file=sys.stderr) | |
print(data, file=sys.stderr) | |
return data |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title> | |
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(function () { | |
var extractToken = function(hash) { |
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
# How expensive is DCI in Ruby? | |
# http://news.ycombinator.com/item?id=4997498 | |
RUBY_VERSION # => "1.9.3" | |
RUBY_PATCHLEVEL # => 362 | |
RUBY_PLATFORM # => "x86_64-darwin12.2.0" | |
require 'benchmark' | |
require 'delegate' | |
require 'forwardable' |
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
# GNU Make 4.1 | |
# the next line has no trailing whitespace | |
A=a | |
B=a# no whitespace before the comment | |
C=a # some whitespace before the comment | |
# the next line has some trailing whitespace | |
D=a | |
default: |
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
module DeepCompact | |
def self.blank?(o) | |
o.nil? || (o.respond_to?(:empty?) && o.empty?) | |
end | |
module Array | |
def deep_compact | |
map.with_object(self.class.new) { |e, o| | |
o << (e.respond_to?(:deep_compact) ? e.deep_compact : e) | |
}.select { |value| !DeepCompact.blank?(value) } |
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
ppjson () { | |
ruby -e "require 'json'; puts JSON.pretty_generate(JSON.parse(STDIN.read))" | |
} |
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
abstract class Beither[+A, +B] { | |
// From German "beide" and English "either" => "beither". | |
// Preferably pronounced as German "Beißer". | |
def left = Beither.LeftProjection(this) | |
def right = Beither.RightProjection(this) | |
def both = Beither.BothProjection(this) | |
} |
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 | |
# Original: https://gist.github.com/helderco/e9d8d072a362ad818f6a | |
set -e | |
show_help() { | |
cat << EOF | |
Usage: ${0##*/} [-s SERV] [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE] | |
${0##*/} -h |
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
# Convert XML to JSON | |
# | |
# Usage: | |
# x2j source_path [xsltjson parameters](https://github.com/bramstein/xsltjson#parameters) | |
# | |
# Reads from standard in if `source_path` set to `-`. | |
x2j() { | |
local base | |
base=src/github.com/bramstein/xsltjson |
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
lprompt() { | |
r=$? | |
[ $r -eq 0 ] && echo "?" || echo "!" | |
} |
NewerOlder