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
var MagicDOM = { | |
createDOM: function (name, attrs) { | |
var i = 0, | |
attr; | |
var elm = new Element(name); | |
var first_attr = attrs[0]; | |
if (MagicDOM._isDict(attrs[i])) { | |
var z; | |
for (z = 0; z < first_attr.length; j++) { |
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 | |
nicepwd=`pwd | sed "s|$HOME|~|"`; | |
# count the number of slashes in pwd | |
slashes=`pwd | perl -pe 's/[^\/]//g' | wc -m` | |
if [ $slashes -le 2 ]; then | |
echo "$nicepwd"; | |
else |
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 charset="utf-8"> | |
<script src="snap.svg.js"></script> | |
</head> | |
<body> | |
<svg id="main" xmlns="http://www.w3.org/2000/svg" version="1.1" height=100%> | |
</svg> | |
<script> |
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 map() { | |
emit(1, { | |
sum: this.value, // the field you want stats for | |
min: this.value, | |
max: this.value, | |
count: 1, | |
diff: 0 | |
}); | |
} |
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
@Grab("org.spockframework:spock-core:0.7-groovy-2.0") | |
import spock.lang.Specification | |
class BuggedTest extends Specification { | |
def thing = [] | |
def "repo the bug"() { | |
given: |
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
#!/usr/bin/env bash | |
############################################################################## | |
## | |
## maven-settings-decoder start up script for UN*X | |
## | |
############################################################################## | |
# Add default JVM options here. You can also use JAVA_OPTS and MAVEN_SETTINGS_DECODER_OPTS to pass JVM options to this script. | |
DEFAULT_JVM_OPTS="" |
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 | |
grep --color "$1\|\$" - |
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 | |
DATECMD='gdate +%s%N' | |
process_stdout() { | |
while read line; do | |
echo -e `$DATECMD`"\t$line" | |
done | |
} |
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
RIGINAL_PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' | |
source `brew --prefix git`/etc/bash_completion.d/git-prompt.sh | |
source `brew --prefix git`/etc/bash_completion.d/git-completion.bash | |
export JAVA_HOME=`/usr/libexec/java_home` | |
export MAVEN_HOME='/usr/local/opt/maven/libexec/' | |
export PATH="$ORIGINAL_PATH:/Users/rchen/dev/tools/bin" |
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 getUserByEmail = (connection, userEmail) => { | |
const userPromise = connection | |
.queryAsync(‘SELECT `id` FROM `user` WHERE `email` = ?’, [ | |
userEmail | |
]) | |
.then(R.head); | |
const permissionsPromise = userPromise | |
.then(R.unless(R.isNil, (user) => connection | |
.queryAsync(‘SELECT `id`, `name` FROM `permission` WHERE `user_id` = ?’, [ |
OlderNewer