Skip to content

Instantly share code, notes, and snippets.

View Florent2's full-sized avatar

Florent Guilleux Florent2

View GitHub Profile
puts header_strings.split(" | ").map { |word| "-" * word.size }.join " | "
@Florent2
Florent2 / pre-commit
Created August 21, 2015 11:55
Git pre commit to abort commit if there are untracked files in the repository
if [[ -n $(git ls-files --other --exclude-standard) ]];
then
echo "commit aborted, there are untracked files!"
exit 1
else
exit 0
fi
- show ||= 'cards'
= div_for user, class: "user-#{show}" do
- if show == 'list'
.user-description
.user-avatar
= avatar(user, class: "user-img")
.user-info
= link_to user.name, "", class: "name"
%p.role= user.role_name
@Florent2
Florent2 / tddium_post_build.rake
Created September 12, 2012 16:56 — forked from semipermeable/tddium_post_build.rake
Tddium post-build task to deploy into Heroku
def run_cmd(cmd)
cmd_output = `#{cmd}`
if $?.to_i.zero?
true
else
puts cmd_output
false
end
end
before { run "cd ~/code/rails_blank_app" }
run "echo -e \"\\033];rails_blank_app\\007\""
run "git st"
tab :name => "vim" do
run "echo -e \"\\033];vim\\007\""
run "vim ."
end
@Florent2
Florent2 / gist:1220951
Last active September 12, 2016 07:28
The technical books I've read
@Florent2
Florent2 / bundler-1.1-is-much-faster
Created August 26, 2011 23:24
Bundler 1.1 is much faster
in a newly created Rails 3.1.0.rc5 application:
$ time bundle _1.0.15_ install
Fetching source index for http://rubygems.org/
[...]
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
real 0m39.081s
user 0m34.663s
sys 0m0.632s
@Florent2
Florent2 / gist:349367
Created March 30, 2010 18:02
prepare iterm tabs for rails project
#!/usr/bin/env ruby
# a script to launch commands in differents iTerm tabs for a Rails project: console, server, mate...
# inspired by http://github.com/chrisjpowers/iterm_window examples
# examples:
# iterm-rails /path/to/project
# iterm-rails project # you can set a default project directory (see configuration options below)
# you can override default configuration options:
# flo_template.rb
# inspired from http://github.com/jeremymcanally/rails-templates/blob/master/daring.rb
# reference for Rails template syntax: lib/rails_generator/generators/applications/app/template_runner.rb
# Delete unnecessary files
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm public/javascripts/*"