Skip to content

Instantly share code, notes, and snippets.

View jonahbron's full-sized avatar

Jonah Bron jonahbron

View GitHub Profile
anonymous
anonymous / untrusted-lvl12-solution.js
Created June 26, 2014 17:04
Solution to level 12 in Untrusted: http://alex.nisnevich.com/untrusted/
/*
* robotNav.js
*
* The green key is located in a slightly more
* complicated room. You'll need to get the robot
* past these obstacles.
*/
function startLevel(map) {
// Hint: you can press R or 5 to "rest" and not move the
@jonahbron
jonahbron / fix_vagrant_boxes.sh
Created October 18, 2013 19:11
Upgrade Vagrant Boxes to 1.1
#!/bin/bash
provider=virtualbox
# Loop over boxes
for box in ~/.vagrant.d/boxes/*; do
# Create provider directory to contain files
mkdir $box/$provider/

The OAuth Dance with FreshBooks

Terminology

  • User - The FreshBooks account, whose information we are trying to access via OAuth
  • Consumer - The FreshBooks account, who we authorize to access the user's information
  • Consumer key - The consumer's subdomain, consumer_key.freshbooks.com
  • Consumer Secret - The consumer's secret, that we will use to make OAuth requests.
  • Request Token - A value used by the consumer to obtain authorization and an access token from the user.
  • Access Token - A value used by the consumer to access the user's information.
  • Access Token Secret - A secret used by the consumer to establish ownership of a given Token.
@jonahbron
jonahbron / sshs.sh
Last active January 18, 2023 19:48
Wrapper for ssh that allows you to automatically source your own .bashrc when logging-in to another computer. Place in your .bashrc file to use.
# Wrapper for ssh to automatically source bash config file on remote machine.
# Sources ~/.bashrc_remote
#
# author Jonah Dahlquist
# license CC0
sshs() {
ssh ${*:1} "cat > /tmp/.bashrc_temp" < ~/.bashrc_remote
ssh -t ${*:1} "bash --rcfile /tmp/.bashrc_temp ; rm /tmp/.bashrc_temp"
}
@jonahbron
jonahbron / explode.sh
Created April 2, 2013 18:54
A very small BASH script to "explode" a directory. That is, move it's contents to it's parent directory, and remove the old (now empty) directory. Very handy after unzipping archives, and things of that nature. Be sure to add it to your PATH for easy use.
#!/bin/bash
# Example usage
#
# $ explode dir/
find "$*" -maxdepth 1 -mindepth 1 -exec mv -f {} "$*/../" \;
rmdir "$*"
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@ffeldhaus
ffeldhaus / gist:3407267
Created August 20, 2012 19:57
bundle install with puppet-rvm
exec { 'bundle install':
command => '/usr/local/rvm/bin/rvm 1.9.3@rocci-server do bundle install',
cwd => '/home/occi/rocci-server',
logoutput => true,
}
@haf
haf / gist:2843680
Created May 31, 2012 14:19
Get SSH working on Vagrant/Windows/Git

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

# if Util::Platform.windows?
  # raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                       # :port => ssh_info[:port],
                                       # :username => ssh_info[:username],
 # :key_path =&gt; ssh_info[:private_key_path]
@paulsmith
paulsmith / verbatim_templatetag.py
Created October 25, 2011 19:03 — forked from ericflo/verbatim_templatetag.py
verbatim Django template tag
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@dmachi
dmachi / LocalStorage.js
Created March 22, 2011 05:26
LocalStorage wrapper providing dojo.store interface
define("dojo/store/LocalStorage", ["dojo", "dojo/store/util/QueryResults", "dojo/store/util/SimpleQueryEngine"], function(dojo) {
dojo.declare("dojo.store.LocalStorage", null, {
constructor: function(/*dojo.store.LocalStorage*/ options){
// summary:
// localStorage based object store.
// options:
// This provides any configuration information that will be mixed into the store.
// This should generally include the data property to provide the starting set of data.
if (!dojo.global.localStorage){