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
/** | |
* @param {Object.<string, boolean>} data | |
* @return {number} | |
*/ | |
function hello(data) { | |
var q = 0; | |
if (data.a) { | |
if (data.b && data.c) { | |
q = 1 | |
} else if (data.d) { |
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 scan = (function(window, document) { | |
/** | |
* Scans through all the pages and maps all the reviews. | |
* | |
* TODO: automatically switch to date-ordered reviews, and page backwards to | |
* beginning. | |
* | |
* @param {function(?Error, Object, Array)} callback The callback when all reviews have | |
* been found. | |
*/ |
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
script | |
VALUE="PONG" | |
echo "START" >> /var/log/stupid-test.log | |
if [ "$VALUE" == "PONG" ]; then | |
echo "GOOD PONG" >> /var/log/stupid-test.log | |
fi | |
if [ "$VALUE" != "PONG" ]; then | |
echo "BAD PONG" >> /var/log/stupid-test.log | |
fi | |
if [ "$VALUE" == "PING" ]; 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
function\s*[^\(]*\(\s*([\$a-z][\$a-z0-9]*)\s*\)\s*\{\s*return\s+\1\s*;?\s*\} |
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 scipy.optimize | |
# let check_grad work for x0: ndarray, like the documentation says it should | |
# see also: http://stackoverflow.com/q/15040263 | |
def check_grad(func, grad, x0, *args, **kwargs): | |
return scipy.optimize.check_grad(lambda xh: func(xh.reshape(x0.shape), *args), | |
lambda xh: grad(xh.reshape(x0.shape), *args).flatten(), | |
x0.flatten(), **kwargs) |
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 | |
INTERVAL=1 | |
afile="$(mktemp)" | |
bfile="$(mktemp)" | |
function show_diff() { | |
a="$1" | |
b="$2" |
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 tensorflow as tf | |
dataset = tf.data.Dataset.from_generator(lambda: None, tf.float32) | |
# raises no errors | |
dataset.map(lambda i: (i, tf.zeros(tf.float32))) | |
zeros = tf.zeros(tf.float32) | |
# raises KeyError: 'zeros:0' | |
dataset.map(lambda i: (i, zeros)) |
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 | |
# this script requires curl, jq, and npm to be available in the PATH | |
# it also requires a github access token (with org read access) to be in ~/.dependabotrc.json in | |
# this form: | |
# {"github_token":"<token>"} | |
if [[ "$#" -lt 1 ]]; then | |
echo "usage: $0 <package_name>" >&2 | |
exit 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 | |
if [ "$#" -eq 0 ]; then | |
md5sum "$@" | |
exit 0 | |
fi | |
recursive=0 | |
exclude=0 | |
sum=0 |