Skip to content

Instantly share code, notes, and snippets.

View jcmuller's full-sized avatar

Juan C. Müller jcmuller

View GitHub Profile
@jcmuller
jcmuller / Nice bash shortcuts
Created October 3, 2010 22:34
Some of my favorite bash tricks
Some of my favorite bash tricks (most of these come straight from Emacs):
Of course, most of these will ONLY work when 'set -o emacs'
C-F Move to next character
C-B Move to previous character
C-A Jump to beginning of line (bol)
C-E Jump to end of line (eol)
M-B Jump to previous word
M-F Jump to next word
@jcmuller
jcmuller / vim-maps.vim
Created August 9, 2011 14:59
Useful vim key mappings
""""""""""""""""""""""""
" Useful maps
""""""""""""""""""""""""
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
" Don't use arrow keys
map <up> <nop>
map <down> <nop>
@jcmuller
jcmuller / before_compile_assets.rb
Created November 30, 2012 21:21 — forked from ilyakatz/before_compile_assets.rb
Selective compilation
last_revision = `cat #{current_path}/current/REVISION`
assets_modified = `git diff --name-only #{last_revision} | grep assets | wc -l`
if assets_modified > 0
STDERR.puts "#{assets_modified} asset files changed detected. Compiling assets"
run! "bundle exec rake RAILS_ENV=#{config.framework_env} RAILS_GROUPS=assets assets:precompile"
else
STDERR.puts "No asset changes detected. Copying assets from previous"
run! "#{shared_path}/last_assets #{shared_path}/assets"
end
@jcmuller
jcmuller / success!.sh
Created December 2, 2012 01:55
Success creating source
$ lwp-request -m POST http://data.mwater.co/msewage/apiv2/users/jcmuller
{"clientuid": "a695036f9c6d41d4980c0bf460cdc18e", "roles": []}%
$ lwp-request -m PUT http://data.mwater.co/msewage/apiv2/users/7ecfbf201e500130ac78109add5e2ae1\?clientuid\=a695036f9c6d41d4980c0bf460cdc18e
Please enter content (text/plain) to be PUTed:
created_by=jcmuller&description=SomeDescription&latitude=23.23243&longitude=87.863731&name=NARUGRAM&source_type=0&
<html><body><h1>Internal error</h1>Ticket issued: <a href="/admin/default/ticket/msewage/208.185.19.18.2012-12-02.01-54-15.4ba33f99-7b79-4043-9185-130f0b6d77e9" target="_blank">msewage/208.185.19.18.2012-12-02.01-54-15.4ba33f99-7b79-4043-9185-130f0b6d77e9</a></body><!-- this is junk text else IE does not display the page: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--type-add=ruby=.feature
--type-set=cucumber=.feature
--type-add=js=.coffee
--type-add=css=.scss
--type-add=html=.handlebars
@jcmuller
jcmuller / enable-edit-command-line.zsh
Created April 24, 2013 17:37
Use this to enable editing of your command on your $EDITOR.
autoload edit-command-line
zle -N edit-command-line
bindkey '^X^E' edit-command-line
irb(main):001:0> class A; def self.b; puts "A"; end; end
=> nil
irb(main):002:0> class B < A; end
=> nil
irb(main):003:0> B.b
A
=> nil
@jcmuller
jcmuller / ctags
Last active December 20, 2015 11:38
ctags script for git hooks
#!/bin/bash
# Install at ~/.git_template/hooks/ctags (and set init.templatedir to ~/.git_template)
set -e
PATH="/usr/local/bin:$PATH"
trap "rm -f .git/tags.$$" EXIT
ctags --tag-relative -Rf.git/tags.$$ --exclude=.git --exclude='*.min.*'
mv .git/tags.$$ .git/tags
--ignore-ack-defaults
--ignore-directory=is:.bzr
--ignore-directory=is:.cdv
--ignore-directory=is:~.dep
--ignore-directory=is:~.dot
--ignore-directory=is:~.nib
--ignore-directory=is:~.plst
--ignore-directory=is:.git
--ignore-directory=is:.hg
--ignore-directory=is:.pc
@jcmuller
jcmuller / fix.sh
Last active December 21, 2015 17:49
$ rvm ruby-1.9.3-p429@platform-dev-param --create
$ bundle check
Gemfile syntax error:
Gemfile:12: syntax error, unexpected ':', expecting $end
gem "sso", git: "[email protected]:challengepost...
^
Gemfile syntax error:
Gemfile:12: syntax error, unexpected ':', expecting $end
gem "sso", git: "[email protected]:challengepost...
^