This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@ec2-72-44-38-243:~# crontab -l | |
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/sbin | |
MAILTO=system@keldelice.com | |
# Automatically set the clock for all machines | |
15 4 * * * ntpdate pool.ntp.org | |
# Reindex task, only on app primary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Address < ActiveRecord::Base | |
named_scope :primary, :conditions => { :primary => true } | |
named_scope :not_primary, :conditions => { :primary => false } | |
end | |
>> a = Address.primary.new | |
=> #<Address id: nil, address: nil, zip_code: nil, city: nil, primary: true, group_id: nil, user_id: nil, country_id: nil, created_at: nil, updated_at: nil> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Problem with :order, all and will_paginate ? | |
# | |
# This one should NOT work, but will_paginate seems not to use the :order option... | |
# | |
>> User.all.paginate(:page => 1, :order => "superpipolol") | |
=> [#<User id: 1, last_name: "Team", first_name: "The-Sphere", email: "admin@the-sphere.com", ...] | |
# This fails as expected. | |
# | |
>> User.paginate(:all, :page => 1, :order => "superpipolol") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imac-de-nicolas-blanco:THE-SPHERE nicolas$ irb | |
irb(main):001:0> def cool(a, b, c) | |
irb(main):002:1> a+b+c | |
irb(main):003:1> end | |
=> nil | |
irb(main):004:0> cool(1,2,3) | |
=> 6 | |
irb(main):005:0> t = [1,2,3] | |
=> [1, 2, 3] | |
irb(main):006:0> cool t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HAML < 2.2 : | |
%a{ :href => "http://haml-lang.com", :title => "Haml's so cool!" } | |
HAML >= 2.2 | |
%a(href="http://haml-lang.com" title="Haml's so cool!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$('#password-clear').show(); | |
$('#password-password').hide(); | |
$('#password-clear').focus(function() { | |
$('#password-clear').hide(); | |
$('#password-password').show(); | |
$('#password-password').focus(); | |
}); | |
$('#password-password').blur(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################################################### | |
# I18n French translation for Devise (http://github.com/plataformatec/devise) | |
# I18n traduction de français pour Devise | |
# | |
# Note from author: I'm not a native French speaker. Please correct my French. | |
# Note de l'autheur: Je ne parle pas beaucoup de français. Pourriez-vous corriger mon français, | |
# s'il vous plait? | |
######################################################################################################### | |
fr: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def p_cool(text=nil, options={}, &proc) | |
raise ArgumentError, "Missing block or text" unless block_given? or text | |
if block_given? | |
concat(p_cool(capture(&proc), options)) | |
else | |
content_tag("p", text, options.merge(:class => "my_cool_class")) | |
end | |
end | |
# In the view : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :bundler do | |
task :create_symlink, :roles => :app do | |
set :bundle_dir, File.join(release_path, 'vendor', 'bundle') | |
shared_dir = File.join(shared_path, 'bundle') | |
run "rm -rf #{bundle_dir}" | |
run "mkdir -p #{shared_dir} && ln -s #{shared_dir} #{bundle_dir}" | |
end | |
task :bundle_new_release, :roles => :app do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export CLICOLOR=1 | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
export PATH="$HOME/bin:$PATH" | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
### https://github.com/magicmonty/bash-git-prompt | |
source ~/.bash/gitprompt.sh | |
### Added by the Heroku Toolbelt |