Skip to content

Instantly share code, notes, and snippets.

View remi's full-sized avatar
👋

Rémi Prévost remi

👋
View GitHub Profile
inoremap <buffer> ;fu function() {<CR>}<Esc>V<<Esc>O
inoremap <buffer> ;cl console.log();<Esc>hi
inoremap <buffer> ;al alert();<Esc>hi
inoremap <buffer> ;rf return false;<Esc>
hi Todo guifg=#ffffff guibg=#bb0000 gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
match Todo /\s\+$/
@remi
remi / string.rb
Created September 16, 2010 15:24
boolean_value = true
first_string = ""
second_string = ""
# not working, since this is an assignment
(boolean_value ? first_string : second_string) = 'lol'
# working, since `replace` is a method
(boolean_value ? first_string : second_string).replace 'lol'
@remi
remi / mo-to-po.sh
Created November 23, 2010 21:06
Use homebrew’s gettext to generate a .mo file from a .po file
#!/bin/bash
`brew --prefix gettext`/bin/msgfmt -c -o fichier.mo fichier.po
@remi
remi / config.php
Created January 17, 2011 00:05
Pinboard bookmarks with Pubwich
array('Pinboard', 'bookmarks', array(
'username' => '__username__',
'total' => 10,
'title' => 'Pinboard',
'description' => 'latest bookmarks',
'secret' => '__secret__',
)
),
#!/usr/bin/env bash
tmux split-window
tmux split-window
tmux split-window
tmux select-layout tiled
tmux send-keys -t 0 cd\ ~/Code
tmux send-keys -t 0 Enter
tmux send-keys -t 1 cd\ ~/Music
tmux send-keys -t 1 Enter
tmux send-keys -t 2 cd\ ~/Dropbox
@remi
remi / update-chromium-mac.rb
Created March 24, 2011 14:26
Running this file update /Applications/Chromium.app to the latest Chromium build.
#!/usr/bin/env ruby
require "open-uri"
if ARGV.first
build_id = ARGV.first
else
build_id = open("http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE") { |data| data.read }
end
build_url = "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/#{build_id}/chrome-mac.zip"
@remi
remi / .tmux.conf
Created March 31, 2011 13:59
Remap ^A-% and ^A-s to split windows in tmux and keeping the current working directory. Place the `split-tmux` in your $PATH and add the two tmux config lines into your `.tmux.conf` file.
bind % send-keys " split-tmux -h" \; send-keys "Enter"
bind s send-keys " split-tmux -v" \; send-keys "Enter"
@remi
remi / .zshrc
Created April 6, 2011 19:00
Move the ruby file to your $PATH as `open-after-migration`. For extra points, add a global alias for zsh.
# Usage: rails g migration add_some_other_stuff O
alias -g O='| open-after-migration'
@remi
remi / gem.rb
Created April 30, 2011 19:51
Global gemset gem installation confirmation. Add this file to your $PATH as `gem`..
#!/usr/bin/env ruby
gemset = `rvm gemset name`.chomp
if gemset == "global" and ARGV.first == "install"
print "It looks like you are about to install a gem in the global gemset.\n"
print "Are you sure? (Y/n) "
exit(1) unless STDIN.gets =~ /y/i
end
system("~/.rvm/bin/gem #{ARGV.join(" ")}")