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
Precompile assets for Heroku | |
RAILS_ENV=production bundle exec rake assets:precompile | |
//Copied from http://jeremyjbarth.blogspot.com/2011/10/rails-31-asset-pipeline-on-heroku.html | |
heroku create app_name --addons custom_domains -r git_remote -s cedar | |
heroku run rake db:migrate --app app_name | |
heroku domains:add www.your_domain.com --app app_name | |
change dns entry to point to app_name.heroku.com |
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
function isCreditCard( CC ) { | |
if (CC.length > 19) | |
return (false); | |
var sum = 0, mul = 1, l = CC.length, digit; | |
for (var i = l; i > 0; i--) { | |
digit = CC.substring(i-1, i); | |
tproduct = parseInt(digit)*mul; | |
sum += tproduct >= 10 ? (tproduct % 10) + 1 : tproduct; |
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
function countdown(){ | |
var index = 10; | |
function log() { | |
console.log(index); | |
} | |
return function iterate(){ | |
log(); | |
if(index>1) setTimeout(iterate, 1000); |
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
function Person(name) { | |
this.name = name; | |
} | |
Person.prototype.getName = function() { | |
return this.name; | |
} | |
var thomas = new Person('Thomas'); | |
var amy = new Person('Amy'); |
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
Prototype is intimately tied to constructors so calls to prototype only works on a constructor function (for example Fruit) | |
Prototype is more memory efficient (50 copies of the eat function for 50 fruit instances) but could be harder to read and maintain | |
Prototype works in a delegation fashion |
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
<div id="the_div"> | |
<ul id="the_list"> | |
<li id="the_item">Click me!</li> | |
</ul> | |
</div> | |
<p id="log"></p> | |
<script type="text/javascript" charset="utf-8"> | |
function log(string){ |
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
If this is your first install, automatically load on login with: | |
mkdir -p ~/Library/LaunchAgents | |
cp /usr/local/Cellar/mongodb/1.8.2-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/ | |
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist | |
If this is an upgrade and you already have the org.mongodb.mongod.plist loaded: | |
launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist | |
cp /usr/local/Cellar/mongodb/1.8.2-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/ | |
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist |
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
set :sync_directories, ["public/assets", "public/galleries"] | |
set :sync_backups, 3 |
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
ffmpeg -i Roman_Holiday.avi -f mp4 -vcodec libxvid -maxrate 1000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -strict experimental -mbd 2 -s 320x240 -ab 128 -b 400 Roman_Holiday.mp4 |
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
RAILS_ENV=production bundle exec rake assets:precompile |