gem install rails --pre
rails new my_app -T
kill $(ps aux | grep ruby | awk '{print $2}') |
server { | |
listen 80; | |
return 301 https://\$host\$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate [PATH_TO_SSL_CERT]; | |
ssl_certificate_key [PATH_TO_SSL_CERT_KEY]; |
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
clearTimeout(timeout); |
var getCache = (function() { | |
var supportsLocalStorage = 'localStorage' in window; | |
// both functions return a promise, so no matter which function | |
// gets called inside getCache, you get the same API. | |
function getJSON(key) { | |
return jQuery.getJSON(key).then(function(data) { | |
localStorage.setItem(key, JSON.stringify(data)); | |
}).promise(); | |
} |
require 'my-sinatra-app' | |
require 'sinatra/activerecord/rake' | |
desc "run irb console" | |
task :console, :environment do |t, args| | |
ENV['RACK_ENV'] = args[:environment] || 'development' | |
exec "irb -r irb/completion -r my-sinatra-app" | |
end |