This file contains hidden or 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
gem install haml hpricot ruby_parser slim haml2slim | |
rails generate devise:views | |
for i in `find app/views/devise -name '*.erb'` ; do html2haml -e $i ${i%erb}haml ; rm $i ; done | |
for i in `find app/views/devise -name '*.haml'` ; do haml2slim $i ${i%haml}slim ; done | |
for i in `find app/views/devise -name '*.haml'` ; do rm $i ; done |
This file contains hidden or 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
// using: https://github.com/igorescobar/jQuery-Mask-Plugin | |
// version: v0.5.0+ | |
var SPphoneMask = function(phone, e, currentField, options){ | |
return phone.match(/^(\(?11\)? ?9(5[0-9]|6[0-9]|7[01234569]|8[0-9]|9[0-9])[0-9]{1})/g) ? '(00) 00000-0000' : '(00) 0000-0000'; | |
}; | |
$(".sp_celphones").mask(SPphoneMask, {onKeyPress: function(phone, e, currentField, options){ | |
$(currentField).mask(SPphoneMask(phone), options); | |
}}); |
This file contains hidden or 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
# This bash script will update your PS1 configuration to inform you about: | |
# - current hour | |
# - current logged user | |
# - machine name | |
# - current path | |
# - status of current branch: | |
# - untracked files | |
# - uncommited changes | |
# - when nothing is changed on current branch | |
# - inform you when the current user.name and user.email is different of the global settings |
This file contains hidden or 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
desc "Manage the encoding header of Ruby files" | |
task :utf8_encode_headers => :environment do | |
files = Array.new | |
["*.rb", "*.rake"].each do |extension| | |
files.concat(Dir[ File.join(Dir.getwd.split(/\\/), "**", extension) ]) | |
end | |
files.each do |file| | |
content = File.read(file) | |
next if content[0..16] == "# coding: UTF-8\n\n" || |
This file contains hidden or 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 SomeModel | |
# include Mongoid::Document | |
# include Mongoid::DateField | |
# | |
# date_field :date_field1, Date | |
# date_field :date_field2, DateTime | |
# date_field :date_field3, Time | |
# end | |
module Mongoid |
This file contains hidden or 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
# /etc/varnish/default.vcl | |
# Define the list of backends (web servers). | |
# Port 80 Backend Servers | |
backend yourapp_webserver1 { | |
.host = "000.000.000.000"; | |
.port = "80"; | |
.max_connections = 250; | |
.connect_timeout = 5s; | |
.first_byte_timeout = 5s; | |
.between_bytes_timeout = 5s; |
This file contains hidden or 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
# dumping a data subset | |
mongodump --port 8080 --out /tmp/collection_name -d database_name -c collection_name --query '{"created_at" : {"$gte" : {"$date" : 1353578400000} }}' | |
# exporting a data subset | |
mongoexport --port 8080 --out /var/collection_name.json -d database_name -c collection_name --query '{"updated_at" : {"$gte" : {"$date" : 1353578400000} }}' | |
# importing a data subset | |
mongoimport --port 8080 -d database_name -c collection_name --upsert --file /var/deny/collection_name.json |
This file contains hidden or 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
sudo su - && yum update -y | |
yum groupinstall "Development Tools" | |
yum install wget -y | |
yum install openssl-devel.i686 openssl.i686 | |
cd /root && wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
tar xvzf ruby-1.9.3-p194.tar.gz && cd ruby-1.9.3-p194 | |
./configure --disable-install-doc --with-opt-dir=/usr/lib/openssl | |
make && make install |
This file contains hidden or 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
# In spec/support/callback_disabler.rb | |
module CallbackDisabler | |
def self.store_callbacks(model, filters) | |
model = constantize(model) | |
filters.each do |filter| | |
model.send("_#{filter}_callbacks").each do |callback| | |
stored_callbacks[model] << { | |
filter: filter, kind: callback.kind, raw_filter: callback.raw_filter | |
} |
OlderNewer