Skip to content

Instantly share code, notes, and snippets.

View urfolomeus's full-sized avatar

Alan Gardner urfolomeus

View GitHub Profile
@urfolomeus
urfolomeus / .vimrc
Created April 17, 2012 09:44 — forked from andyfowler/.vimrc
Swap iTerm2 cursors in vim insert mode when using tmux
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
{
browser : 'Chrome',
mail : 'Sparrow',
calendar : 'iCal',
twitter : 'Twitter.app',
campfire : 'Propane',
contacts : 'Cobook',
terminal : 'iTerm2',
editor : 'vim',
notes : 'Evernote',
@urfolomeus
urfolomeus / heroku_db_migrate.rb
Created August 4, 2012 15:12
Quick script to migrate heroku apps to the new free individual postgres DBs
## README
# This is a quick script I hacked out to migrate all my heroku apps
# to the new free individual postgres DBs. To use it:
# - install the heroku gem if you don't already have it
# - set the value of IGNORE_OTHERS_APPS to true if you only want to
# run the script against apps you've created yourself
# - add any apps you want to ignore because they don't use PostgreSQL
# (or for any other reason) to the IGNORE_LIST
## CAVEAT!!
@urfolomeus
urfolomeus / gist:5090510
Created March 5, 2013 14:04
My customisations to the neo vim-config
" Default color scheme
color vibrantink
" Change cursor in insert mode
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
def create
user = User.find_by_omniauth(request.env["omniauth.auth"])
if user
path = root_url
else
user = User.create_with_omniauth(request.env["omniauth.auth"])
path = edit_user_path(user)
session[:new_user] = true
end
session[:user_id] = user.id
#!/usr/bin/env ruby
##
# script to amend a commit which should be been created with the previous script
##
commit_message = `git log --format=%B -1`.strip
branch_name = `git rev-parse --abbrev-ref HEAD`.strip
matches = branch_name.match (/\w\-(\d+)\Z/i)
@urfolomeus
urfolomeus / na_no_bot.rb
Last active December 27, 2015 00:59
NaNoWriMo helper script. Gives you a quick summary of progress so far.
#!/usr/bin/env ruby
class NaNoBot
TARGET_WORDS = 50000
TOTAL_DAYS = 30
WELL_DONE = [
"Get in!",
"Doing great!",
"Nice job!",
@urfolomeus
urfolomeus / gist:7958451
Created December 14, 2013 12:06
sublime prefs
{
"color_scheme": "Packages/Theme - Railscasts/Railscasts.tmTheme",
"font_face": "monaco",
"font_size": 14,
"save_on_focus_lost": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true
}
defmodule TspSolver.Fitness do
import TspSolver.Helpers
@city_distances HashDict.new(
[
{ {:Aberdeen, :Dundee}, 67 },
{ {:Aberdeen, :Edinburgh}, 129 },
{ {:Aberdeen, :Glasgow}, 146 },
{ {:Aberdeen, :Inverness}, 105 },
{ {:Aberdeen, :Perth}, 84 },

Keybase proof

I hereby claim:

  • I am urfolomeus on github.
  • I am mr_urf (https://keybase.io/mr_urf) on keybase.
  • I have a public key whose fingerprint is 7B00 D961 9D80 A819 25F4 E1BF 8BA8 5E57 E481 E6D4

To claim this, I am signing this object: