Skip to content

Instantly share code, notes, and snippets.

View megatux's full-sized avatar
🏠
Working from home

Cristian Molina megatux

🏠
Working from home
View GitHub Profile
@megatux
megatux / error_brew_install_ffmpegthumbnailer
Created September 20, 2011 21:53
error installing ffmpegthumbnailer
==> Downloading http://ffmpegthumbnailer.googlecode.com/files/ffmpegthumbnailer-2.0.6.tar.gz
File already downloaded in /Users/cristian/Library/Caches/Homebrew
/usr/bin/tar xf /Users/cristian/Library/Caches/Homebrew/ffmpegthumbnailer-2.0.6.tar.gz
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/ffmpegthumbnailer/2.0.6
./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/ffmpegthumbnailer/2.0.6
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
@megatux
megatux / gist:1633163
Created January 18, 2012 14:09
make links with attrib rel=external open in new window
$('A[rel="external"]')
.click( function() {
window.open( $(this).attr('href') );
return false;
});
@megatux
megatux / gist:1633443
Created January 18, 2012 15:12
format decimals, complete with "0"s
sprintf("%03d", 4)
"%05d" % 123
@megatux
megatux / gist:1633716
Created January 18, 2012 15:58
Search and Replace a Word in all Files within Directory
# If you want to search and replace a word in all files within a specified directory in Unix, do the following:
# For example, here I wanted to do a global search and replace of all files within the current directory to ’2010′ from ’2008′.
find . -type f | xargs perl -pi -e 's/2008/2010/g'
@megatux
megatux / gist:1635627
Created January 18, 2012 20:59
html5shim IE fixes for HTML
/[if lt IE 9] <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@megatux
megatux / gist:1706396
Created January 30, 2012 20:13
mock web access (http open) with webmock
#In Gemfile:
group :test do
gem 'webmock'
end
#In test class:
def setup
mock_file = Rails.root.join("test", "fixtures", "some_saved_website.html")
@megatux
megatux / gist:1781957
Created February 9, 2012 18:47
Ruby, Rails : make path to file
Rails.root.join("config", "locales", "es-AR", "blabla.yml")
@megatux
megatux / gist:1829011
Created February 14, 2012 18:43
Ruby Date from String & String from Date
Date.strptime("09-02-2012", "%d-%m-%Y")
------------------------------------------------------------------- Time#strftime
time.strftime( string ) => string
---------------------------------------------------------------------------------
Formats time according to the directives in the given format string. Any text not listed as a directive will be passed through to the output string.
"
Format meaning:
@megatux
megatux / campfire_emoji
Created July 2, 2012 15:47
campfire emoji
## Surround these with : e.g. :calling:
sunny, zap, leaves, lipstick, cop, wheelchair, fish,
hammer, moneybag, calling, memo, mega, gift, pencil, scissors,
feet, runner, heart, smoking, warning, ok, tm, vs, new, bulb, zzz,
sparkles, star, mag, lock, email, fist, v, punch, +1, clap, -1
## Sounds ( e.g. /play tada )
tada, nyan, tmyk, rimshot, trombone, crickets, live, ohmy, greatjob, yeah, secret, pushit, drama, vuvuzela
@megatux
megatux / gist:4557505
Created January 17, 2013 16:57
installing & running Arcadia IDE
cristian:~/code$ gem install arcadia
Fetching: arcadia-0.12.1.gem (100%)
Successfully installed arcadia-0.12.1
1 gem installed
cristian:~/code$ rbenv rehash
cristian:~/code$ arcadia
/Users/cristian/.rbenv/versions/1.9.3-p194-perf/lib/ruby/1.9.1/tk.rb:3011:in `_invoke': bad window path name ".w00000" (RuntimeError)
from /Users/cristian/.rbenv/versions/1.9.3-p194-perf/lib/ruby/1.9.1/tk.rb:3011:in `_invoke'