Skip to content

Instantly share code, notes, and snippets.

@pifleo
pifleo / Gemfile
Created April 4, 2012 19:01
Rails - I18n routes translation with nested resources and members
...
# routes translation
# https://github.com/kwi/i18n_routing
gem 'i18n_routing'
@pifleo
pifleo / confirmation_instructions.html.haml
Created April 5, 2012 10:12
Rails - Devise i18n mails template fr/en
-# app/views/devise/mailer/confirmation_instructions.html.haml
%p
= t('devise.mailer.welcome', :email => @resource.email)
%p= t('devise.mailer.confirmation_instructions.msg')
%p= link_to t('devise.mailer.confirmation_instructions.link'), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
@pifleo
pifleo / README
Created April 5, 2012 10:32
Rails - devise sign in by username or email - lib on user model
# How To: Allow users to sign in using their username or email address
# https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address
@pifleo
pifleo / README
Created April 5, 2012 10:53
Rails - models organization - Keep code structure in models consistent
# Keep code struture in models consistent
# Inspired by http://rails-bestpractices.com/posts/75-keep-code-struture-in-models-consistent
# One example: (From top to bottom)
associations
scopes
class methods
validates
callbacks
instance methods
@pifleo
pifleo / Fiche-Processus_realisation_d_un_projet_rails.txt
Created April 21, 2012 15:04
Fiche - Processus réalisation d'un projet Rails - @wip
# Author: Pifleo
# Site: http://letmediscover.wordpress.com/
#
1. Avoir une idée
2. Imaginer les première fonctionnalités / extrait de comportements
3. Construire le schéma de BDD
4. Lister les gems principales
5. Lister les models
6. Préparer les commandes de scaffolding
+ références
@pifleo
pifleo / confirmation_instructions.html.haml
Created June 6, 2012 14:37
Devise custom mailer layout with inline attachments
-# app/views/devise_custom_mailer/confirmation_instructions.html.haml
%p
= t('devise.mailer.welcome', :email => @resource.email)
%p= t('devise.mailer.confirmation_instructions.msg')
%p= link_to t('devise.mailer.confirmation_instructions.link'), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
%br
- if @resource.tmp
%p
= t('devise.mailer.confirmation_instructions.password_instruction', :password => @resource.tmp)
@pifleo
pifleo / cmd
Created October 14, 2012 20:59
Proxy List Fetcher Using Ruby
$ chmod +x ./proxy_list_fetcher.rb
$ ./proxy_list_fetcher.rb | head
180.94.88.58 8080 Afghanistan fast HTTPS High +KA
187.87.155.2 8080 Brazil fast HTTPS High +KA
120.132.132.119 8080 China medium HTTPS High +KA
210.211.109.244 8081 Viet Nam fast HTTP Low
216.244.71.143 3128 United States medium HTTPS High +KA
190.237.224.22 8080 Peru slow HTTPS High +KA
@pifleo
pifleo / .bash_aliases
Created December 1, 2012 21:28
Alias
# system
alias tc='ne ~/.bash_aliases'
alias tcs='source ~/.bash_aliases'
alias s='shutdown -h now'
alias ..='cd ..'
# editors
# Emacs
alias e='emacs -nw'
alias ne='emacs -nw'
@pifleo
pifleo / nationality.en.yml
Created August 8, 2017 18:03
List of nationalities FR/EN in Yaml (yml)
# List of nationalities taken from Gist and Gem converted to yaml and translated:
# - https://github.com/JomaMinoza/nationality
# - http://www.codegist.net/code/rails-nationality-select/
# - https://gist.github.com/marijn/274449
# - https://gist.github.com/clawfire/5170433 (fr)
#
# Country:
# - https://github.com/stefanpenner/country_select
# - https://github.com/hexorx/countries/
#