Skip to content

Instantly share code, notes, and snippets.

View mathieuravaux's full-sized avatar

Mathieu Ravaux mathieuravaux

  • Paris
View GitHub Profile
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
@mathieuravaux
mathieuravaux / sl_gems_update.rb
Created September 1, 2009 08:18 — forked from mattetti/sl_gems_update.rb
Gems that need upgrading in snow leopard
#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file path`
to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/
end
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
@mathieuravaux
mathieuravaux / README
Created September 16, 2009 12:06 — forked from avit/README
ToadMate Bookmarklet
Adds clickable links to open the file/line from the
stacktrace on Hoptoad (http://hoptoadapp.com) into TextMate.
INSTALL:
Change the lpd variable to your local project directory.
It relies on your project folders being named after the main part
of your domain name (example.com => /example/).
<h1>Listing tasks</h1>
<table>
<tr>
<th>Name</th>
<th>Complete</th>
</tr>
<% @tasks.each do |task| %>
<tr class="<%= task.complete? ? 'tache effectuée' : 'tache NON effectuée' %>">
namespace :deploy do
PRODUCTION_APP = 'myapp'
STAGING_APP = 'myapp-staging'
def run(*cmd)
system(*cmd)
raise "Command #{cmd.inspect} failed!" unless $?.success?
end
def confirm(message)
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
source "$HOME/.rvm/scripts/rvm"
rvm use 1.9.2 > /dev/null
fi
# app/views/rescues/_trace.erb
<%
traces = [
["Application Trace", @exception.application_backtrace],
["Framework Trace", @exception.framework_backtrace],
["Full Trace", @exception.clean_backtrace]
]
names = traces.collect {|name, trace| name}
%>
@mathieuravaux
mathieuravaux / npm_edit_meets_bundle_open.sh
Created March 18, 2011 01:12
Fellow Noders - Rubyists, treat your muscle memory! `edit` will correctly use `bundle open` or `npm edit` whether `Gemfile.lock` or `package.json` are in the Git root.
function edit {
if [[ "$1" == "" ]]; then echo "usage: edit NAME (NAME is a bundled gem or npm package)"; return; fi
RES=$(git rev-parse --quiet --is-inside-work-tree 2>&1)
if [[ "$?" == "0" ]]; then
GIT_DIR=$(git rev-parse --show-toplevel)
if [[ -f "$GIT_DIR/package.json" ]]; then
npm edit $1
fi
if [[ -f "$GIT_DIR/Gemfile" ]]; then
bundle open $1