In config/production.rb
config.action_mailer.asset_host = "https://123123.cloudfront.net"
In config/initializers/mail_image_tag.rb
module ActionView
brew update | |
brew versions FORMULA | |
cd `brew --prefix` | |
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions" | |
brew install FORMULA | |
brew switch FORMULA VERSION | |
git checkout -- Library/Formula/FORMULA.rb # reset formula | |
## Example: Using Subversion 1.6.17 | |
# |
#!/usr/bin/env ruby | |
# | |
# Whatsapp status crawler for Central America mobile phone numbers. | |
# | |
# Based on a SBD post by Alejandro Ramos: | |
# http://www.securitybydefault.com/2012/03/casi-10-millones-de-moviles-espanoles.html | |
# | |
# Modified by @hugogilmar & @andrexu for mobile phone numbers in El Salvador | |
#-------------------------------------------------------------------------------------- | |
# You must change some parameters matching to your country, your country code, for example. HAVE FUN! |
In config/production.rb
config.action_mailer.asset_host = "https://123123.cloudfront.net"
In config/initializers/mail_image_tag.rb
module ActionView
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
# dump | |
pg_dump testdb | pv -c -s $(psql -tc "SELECT pg_database_size('testdb')") -N dump | gzip > testdb.sql.gz | |
# restore | |
pv testdb_20120501.sql.gz | zcat | psql testdb |
(function($) { | |
$.fn.changeElementType = function(newType) { | |
this.each(function() { | |
var attrs = {}; | |
$.each(this.attributes, function(idx, attr) { | |
attrs[attr.nodeName] = attr.nodeValue; | |
}); | |
$(this).replaceWith(function() { |
class ActiveRecord::Base | |
mattr_accessor :shared_connection | |
@@shared_connection = nil | |
def self.connection | |
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection } | |
end | |
end | |
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection |
git diff --name-only | uniq | xargs mvim
When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.
Once you're in Vim, you can then switch between the files with :n
and :prev
, or another favourite: :w | n
(save current file and open the next command line-supplied file).
UPDATE: see below for a version that works with real terminal commands.
a=b=c=(1..100).each do |num| | |
print num, ?\r, | |
("Fizz" unless (a = !a) .. (a = !a)), | |
("Buzz" unless (b = !b) ... !((c = !c) .. (c = !c))), | |
?\n | |
end |
#!/usr/bin/env sh | |
# Download lists, unpack and filter, write to stdout | |
curl -s https://www.iblocklist.com/lists.php \ | |
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \ | |
| xargs wget -O - \ | |
| gunzip \ | |
| egrep -v '^#' |