Skip to content

Instantly share code, notes, and snippets.

View joechrysler's full-sized avatar

Joe Chrysler joechrysler

  • Atomic Object
  • Grand Rapids, Michigan
View GitHub Profile
@joechrysler
joechrysler / pep8-break.py
Created July 30, 2013 18:33
PEP8 Line Breaks
# In our codebase, we do a lot of this:
if some_really_long_boolean
and another_really_long_boolean
and a_third_really_long_boolean:
print "Yehaw!"
# PEP8 says we should probably be writing thusly
if some_really_long_boolean and
another_really_long_boolean and
a_third_really_long_boolean:
@joechrysler
joechrysler / who_is_my_mummy.sh
Last active January 16, 2026 13:02
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@joechrysler
joechrysler / ping-pong.rb
Created May 16, 2012 20:25
Playing with redis migrations
require "rubygems"
require "redis"
origin = Redis.new(host: '127.0.0.1', port: 6379)
destination = Redis.new(host: '127.0.0.1', port: 6380)
500.times do |i|
origin.set(i, "value#{i}")
end
@joechrysler
joechrysler / gist:2580265
Created May 2, 2012 20:37
Pushing mercurial repositories to github

Pushing mercurial into github

a guide for sceptic's

It's easy they said. Distributed SCMs are all basically the same they said, so transitioning from one to the other is super easy. So easy that in the time it's taken to write this sentence, you should have already installed a plugin and pushed your mercurial repo up to github right?

Lies. Horrible horrible lies.

The mercurial to git conversion is nothing short of a pain. Documentation is spotty and full of that peculiarly glib variety of optimism found most often at fast food eateries and VC-funded startups. But you know that already. That's why you're here after all.

Is all lost?

no. you can escape the plastic land of hg and enter the land of gritty git goodness.

@joechrysler
joechrysler / atomic_lines
Created January 11, 2012 15:26
Move lines of code around using vim's directional keys
" Pop the following into your .vimrc
" Move a line of text using CTRL+[arrows]
nmap <C-down> mz:m+<cr>`z
nmap <C-up> mz:m-2<cr>`z
nmap <C-left> <<
nmap <C-right> >>
vmap <C-down> :m'>+<cr>`<my`>mzgv`yo`z
vmap <C-right> :m'<-2<cr>`>my`<mzgv`yo`z
"" Move around split windows with CTRL+[jkhl]