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
| { | |
| init: function(elevators, floors) { | |
| var idleElevators = []; | |
| var upsRequested = []; | |
| var downsRequested = []; | |
| var goAndSetIndicator = function (elevator, num, index) { | |
| console.log('k: figure out where to go next'); |
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/bash | |
| PID=$(ps aux | grep mysql-dev-backup-s3 | grep -v grep | awk '{ print $2 }') | |
| # for some stupid reason, stat in our vagrant vms takes `-c format` not `-f`... | |
| ontrap () { | |
| echo | |
| exit 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
| #!/bin/bash | |
| echo -n "do you accept the tos (type 'y')? " | |
| read confirm | |
| if [[ "$confirm" == "y" ]]; then | |
| irb | |
| else | |
| echo "fail"; exit 1 | |
| fo |
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/bash | |
| cd /repos/api-internal | |
| case "$2" in | |
| pre-start) | |
| git checkout origin/production | |
| docker pull quay.io/kballenegger/api-internal | |
| docker pull quay.io/kballenegger/api-internal-builder |
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
| // ~Immutable~ Binary Search Tree | |
| class Node<T: Comparable>: Printable { | |
| var left: Node<T>? | |
| var right: Node<T>? | |
| var value: T | |
| init(_ value: T, left: Node<T>? = nil, right: Node<T>? = nil) { | |
| self.value = value | |
| self.left = left | |
| self.right = right |
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/bash | |
| function realpath { echo $(cd "$(dirname $1)"; pwd)/"$(basename $1)"; } | |
| if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then | |
| args=( "$@" ) | |
| # unset last arg | |
| #unset args[$(echo ${#args[@]}-1 | bc)] | |
| unset args[${#args[@]}-1] | |
| # cd into root dir |
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
| git fetch | |
| # check if a deploy is necessary | |
| checked_out=$(git rev-parse HEAD) | |
| production=$(git rev-parse origin/production) | |
| if [ $checked_out = $production ]; then | |
| echo 'Nothing to deploy. Moving on...' | |
| exit 0 | |
| fi |
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
| POST /bill-pay/payees HTTP/1.1 | |
| Accept: application/json | |
| Accept-Encoding: gzip, deflate, compress | |
| Content-Length: 63 | |
| Content-Type: application/json; charset=utf-8 | |
| FreshPay-Authentication: eyJ1c2VyIjo5MjcyNDQ2MDI1MDQ2NTk0MTQsInRpbWUiOjE0MDU5NDk5NDMsInBlcm1pc3Npb25zIjoiYWxsIiwiYXBwIjoiZnJlc2hwYXktd2ViIn0AB4FBJshQOd19bzDkwG9k3xscgASv9vOPSBRldfSuTzU= | |
| Host: localhost:9977 | |
| User-Agent: HTTPie/0.4.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
| SELECT payees.*, max(payments.id) AS most_recent_transaction FROM payees | |
| LEFT OUTER JOIN payments ON payments.payee_id = payees.id | |
| WHERE payees.user_id = ? | |
| GROUP BY payees.id | |
| ORDER BY max(payments.id) DESC; |
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
| find . -name '*.js*' -exec bash -c "ruby -ne 'puts \$_.gsub(/^(( )+)/) {|m| (m.length/2).times.map{|_|\" \"}.join }' <{} >{}.bk && rm -f {} && mv {}.bk {}" \; |