Skip to content
View script.sh
result=0
action() {
false
}
list='1 2 3'
for thing in $list; do
echo $thing
action
result+=$?
View pipes_streams_exit_codes.bash
#!/usr/bin/env bash
# 2>&1 # stderr to stdout
# 1>&2 # stdout to stderr
# 2> # stderr
# > # stdout
# see http://www.tldp.org/LDP/abs/html/io-redirection.html
# exec 3>&1; bundle-audit -v >&3 3>&- | tee reports/bundle-audit.txt 3>&- ; exec 3>&-
# https://stackoverflow.com/questions/1221833/bash-pipe-output-and-capture-exit-status
# <command> | tee out.txt ; test "${PIPESTATUS[0]} -eq 0"
# ( set -o pipefail; command | tee out.txt ); ST=$?
View .babelrc
{
"presets": ["react", "es2015"],
"ignore": [
"data/*.js"
]
}
View recover.md

A stupid way to recover a commit that has been rebased and is now unreachable (ref):

  1. Given unreachable commit https://github.com/org/repo/commits/332a2b9f43f1f8d7730e0a01356ea183dfadd470
  2. See if you can compare them to any earlier commit you have https://github.com/org/repo/compare/f571415f4da9cc28edc83242e353966677dabcd2...332a2b9f43f1f8d7730e0a01356ea183dfadd470
  3. Push your local commit up to a recovery branch git checkout f571415f4da9cc28edc83242e353966677dabcd2; git checkout -b recovery; git push origin recovery
  4. See the patch commits https://github.com/org/repo/compare/recovery...332a2b9f43f1f8d7730e0a01356ea183dfadd470.patch and download as recovery.patch (you could curl unless it's private so blah blah)
  5. Apply the patch commits and push up. git am recovery.patch && git push origin recovery
View southwest.user.js
// ==UserScript==
// @name Southwest Auto Check-In
// @namespace http://dbknickerbocker.blogspot.com
// @description Automatically check-in for Southwest flights
// @include https://southwest.com/flight/retrieveCheckinDoc*
// @include https://www.southwest.com/flight/retrieveCheckinDoc*
// @include https://southwest.com/flight/selectPrintDocument*
// @include https://www.southwest.com/flight/selectPrintDocument*
// @updateURL https://gist.github.com/dbknickerbocker/5730976/raw/southwest.user.js
// @author David B. Knickerbocker
View app.rb
require_relative "selectable_queue"
def run
queue = SelectableQueue.new
result = catch(:timeout) do
object = ->{ rand(5) }
puts "Starting background"
run_background_job(object, queue)
puts "Starting event loop"
run_event_loop(queue)
View reminder.py
import time
import webbrowser
total_breaks = 8
break_count = 0
while (break_count < total_breaks):
time.sleep(3600)
webbrowser.open("https://31.media.tumblr.com/288d6e631cd930de65547ef5044fefb8/tumblr_mlksb86paT1qbuvyto1_500.gif")
break_count = break_count + 1
View ember_examples.md
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
application: Ember.inject.controller(),
queryParams: ['definedInController'],
appName:'Ember Twiddle',
definedInController: 'default'
});
// http://emberigniter.com/should-we-use-controllers-ember-2.0/
// http://guides.emberjs.com/v2.1.0/routing/query-params/
View bin-squash_migrations
#!/usr/bin/env bash
git ls-files db/migrate/*.rb | sort | tail -1 | \
ruby -e "schema_version=STDIN.read[/\d+/]; init_schema=%(db/migrate/#{schema_version}_init_schema.rb);
%x(git rm -f db/migrate/*.rb;
mkdir db/migrate;
git mv db/schema.rb #{init_schema};
rake db:migrate;
git add db/schema.rb; git commit -m 'Squashed migrations')"
Something went wrong with that request. Please try again.