Skip to content

Instantly share code, notes, and snippets.

Avatar
🐱

Jeremy Le Massu elentras

🐱
  • Effy - Pacte Énergie Solidarité
  • Paris, France
View GitHub Profile
@mlanett
mlanett / rails http status codes
Last active Jan 22, 2022
HTTP status code symbols for Rails
View rails http status codes
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
View filterable.rb
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call
@maxim
maxim / rails_load_path_tips.md
Last active Sep 8, 2021
How to use rails load paths, app, and lib directories.
View rails_load_path_tips.md

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

View gist:4195758
# Objet natif Range, support des chaines, chiffres, dates...
# Tous les chiffres entre 0 et 10 inclus.
0..10
#=> 0..10
# Tous les chiffres pairs entre 0 et 10 inclus.
(0..10).select(&:even?)
@SeanPONeil
SeanPONeil / .bash_prompt
Created Sep 13, 2012
Sexy Solarized Bash Prompt, inspired by "Extravagant Zsh Prompt"
View .bash_prompt
# Sexy Solarized Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Customized for the Solarized color scheme by Sean O'Neil
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then TERM=gnome-256color; fi
if tput setaf 1 &> /dev/null; then
tput sgr0
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
BASE03=$(tput setaf 234)
BASE02=$(tput setaf 235)
BASE01=$(tput setaf 240)
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fnhipster
fnhipster / html5.haml
Created Apr 9, 2011
HTML5 HAML Template
View html5.haml
!!! 5
%html
%head
%title= "Your Website"
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
%link{ :href => "/css/screen.css", :media => "screen", :rel => "stylesheet" }