Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@joshmcarthur
joshmcarthur / keybase.md
Created October 14, 2014 02:31
Keybase Verification File

Keybase proof

I hereby claim:

  • I am joshmcarthur on github.
  • I am sudojosh (https://keybase.io/sudojosh) on keybase.
  • I have a public key whose fingerprint is F836 E081 B5FC 98B7 4731 9535 8185 E264 85E5 3C23

To claim this, I am signing this object:

@joshmcarthur
joshmcarthur / .vimrc
Created February 3, 2015 22:21
Relative line number toggles in Vim
" --- snip ---
" Relative Numbering
" =======
:au FocusLost * :set number
:au FocusGained * :set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
" --- snip ---
@joshmcarthur
joshmcarthur / jquery.tableflip.js
Created February 11, 2015 22:20
jquery.tableflip.js
jQuery.fn.tableflip = function() {
console.log("╯°□°)╯︵ ┻━┻");
return this;
}
# Like rspec --format doc, (which minitest doesn't have)
#
# usage: minidoc test/integration/robs_cool_potatoes_test.rb
minidoc() {
rscript='
red = "\e[0;31m"
purple = "\e[0;35m"
green = "\e[0;32m"
blue = "\e[0;34m"
none = "\e[0m"
@joshmcarthur
joshmcarthur / setup_load_paths.rb
Created March 14, 2011 00:50
The required preinitializer for Rails when using RVM in a system-wide installation
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
@joshmcarthur
joshmcarthur / gist:1011639
Created June 7, 2011 03:39
A snippet of deploy script to automatically exclude sensitive files
default_run_options[:pty] = true
set :deploy_via, :copy
set :copy_cache, true
set :copy_exclude, [".git", "config/database.yml", "config/deploy.rb", ".rvmrc"]
@joshmcarthur
joshmcarthur / gist:1055377
Created June 30, 2011 00:43
Spree Hosted Gateway - Process Gateway Return Method
def process_gateway_return
#Find the gateway payment method from the parameters we have received back from the gateway provider
gateway = PaymentMethod.find_by_id_and_type(ExternalGateway.parse_custom_data(params)["payment_method_id"], "ExternalGateway")
# Populate the @order variable and the payment_made variable with the variables returned from the process_response method on the gateway method
# This method returns an array, which is how these two variables get populated.
@order, payment_made = gateway.process_response(params)
# Only do the next bit if the order has been found, and the gateway tells us that the payment has been made successfully
@joshmcarthur
joshmcarthur / ubuntu-rvm.sh
Created July 7, 2011 03:23 — forked from mystix/passenger-nginx-setup.sh
Ubuntu 11.04 (Natty) -- RVM + PostgreSQL + Passenger setup script
# run this script on a fresh Ubuntu server installation as root
# copy public ssh key to server's authorized_keys keychain for simple ssh logins
mkdir -p ~/.ssh
echo -e '<your ssh public key here>' > ~/.ssh/authorized_keys
# setup .gemrc
echo -e '---
:verbose: true
@joshmcarthur
joshmcarthur / spec_helper.rb
Created July 19, 2011 23:23
Omniauth: stub out providers
## Note: This goes inside your spec_helper.rb file - if using Spork, inside the Spork.prefork block
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock(:twitter, {
:uid => '123456789'
})
OmniAuth.config.add_mock(:facebook, {
:uid => '123456789'
})