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
| from: http://blog.anhangzhu.com/2016/05/03/easy-rails-deployment-with-rsync/ | |
| First, have an rsync_exclude file: | |
| // my-rails-app/.rsync_exclude | |
| .bundle | |
| tmp | |
| log | |
| Run in localhost: | |
| $ bundle exec rake assets:precompile |
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
| if Rails.env | |
| rails_env = Rails.env.production? ? 'PROD' : Rails.env[0...3].downcase | |
| current_app = Dir.pwd.split('/').last.capitalize | |
| IRB.conf[:PROMPT].reverse_merge!(:RAILS_ENV => {:PROMPT_I=>"#{current_app} #{rails_env} >> ", :PROMPT_N=>"#{current_app} #{rails_env} >> ", :PROMPT_S=>nil, :PROMPT_C=>"?> ", :RETURN=>"=> %s\n"}) | |
| IRB.conf[:PROMPT_MODE] = :RAILS_ENV | |
| end |
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
| # SQLite version 3.x | |
| # gem install sqlite3 | |
| development: | |
| adapter: sqlite3 | |
| database: db/development.sqlite3 | |
| pool: 5 | |
| timeout: 5000 | |
| # Warning: The database defined as "test" will be erased and | |
| # re-generated from your development database when you run "rake". |
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
| for i in * | |
| do | |
| mv "$i" "$RANDOM.JPG" | |
| 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
| // Super basic html parser written with regex. | |
| // Experimental and untested | |
| function parseParams(str){ | |
| return JSON.parse("{"+ | |
| str.replace(/.+?=.+?(&|$)/g, | |
| function(part){ return part.replace(/(.+)(=)([^&]+)(&*)/, | |
| function(x, key, eq, val, com){return ["\"",key,"\"",":","\"",val,"\"",(com ? "," : '')].join('');}) | |
| }) +"}"); | |
| } |
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
| AZHU.storage = { | |
| save : function(key, jsonData, expirationMin){ | |
| if (!Modernizr.localstorage){return false;} | |
| var expirationMS = expirationMin * 60 * 1000; | |
| var record = {value: JSON.stringify(jsonData), timestamp: new Date().getTime() + expirationMS} | |
| localStorage.setItem(key, JSON.stringify(record)); | |
| return jsonData; | |
| }, | |
| load : function(key){ | |
| if (!Modernizr.localstorage){return false;} |