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
upstream myapp_puma { | |
server unix:/tmp/myapp_puma.sock fail_timeout=0; | |
} | |
# for redirecting to https version of the site | |
server { | |
listen 80; | |
rewrite ^(.*) https://$host$1 permanent; | |
} | |
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
server { | |
listen 80; | |
root /home/username/example.com; | |
index index.php index.html; | |
server_name example.com; | |
location / { | |
try_files $uri $uri/ /index.php?q=$uri&$args; |
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
# for redirecting hhtp traffic to https version of the site | |
server { | |
listen 80; | |
server_name example.com; | |
return 301 https://$server_name$request_uri; | |
} | |
# for redirecting to non-www version of the site | |
server { | |
listen 80; |
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
<form id="loginForm" action="/whatever" method="post"> | |
<div class="row"> | |
<div class="seven columns"> | |
<label for="email">Email Address</label> | |
<input type="text" name="email" id="emailField" placeholder="name@example.com" required/> | |
<label for="password">Password</label> | |
<input type="password" name="password" id="passwordField" required/> | |
<button type="submit" class="button-primary">Sign In</button> |
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
require 'rubygems' | |
require 'sinatra/base' | |
require 'sinatra/content_for' | |
require 'dalli' | |
class MyBlog < Sinatra::Base | |
helpers Sinatra::ContentFor | |
set :dc, Dalli::Client.new('localhost:11211') | |
get '/articles/:id' do |
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
<!-- /dfp_account_id/ad_unit_1 --> | |
<div id='div-gpt-ad-xxxxxxxxxx-0'> | |
<script> | |
googletag.cmd.push(function() { googletag.display('div-gpt-ad-xxxxxxxxxx-0'); }); | |
</script> | |
</div> |
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
// Load APS library | |
!function(a9,a,p,s,t,A,g){if(a[a9])return;function q(c,r){a[a9]._Q.push([c,r])}a[a9]={init:function(){q("i",arguments)},fetchBids:function(){q("f",arguments)},setDisplayBids:function(){},targetingKeys:function(){return[]},_Q:[]};A=p.createElement(s);A.async=!0;A.src=t;g=p.getElementsByTagName(s)[0];g.parentNode.insertBefore(A,g)}("apstag",window,document,"script","//c.amazon-adsystem.com/aax2/apstag.js"); | |
apstag.init({ | |
pubID: 'pub_id_amazon_uam', | |
adServer: 'googletag', | |
simplerGPT: true | |
}); | |
var googletag = googletag || {}; |
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
## Enable gzip ## | |
gzip on; | |
gzip_disable "msie6"; | |
gzip_vary on; | |
gzip_min_length 5120; | |
gzip_proxied any; | |
gzip_comp_level 4; | |
gzip_buffers 16 8k; | |
gzip_http_version 1.1; |
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
### change APP_NAME and REPO ### | |
### Also replace example.com with your domain, it requires DNS setup, atleast a local entry in ssh-config or hosts file | |
require 'rake/remote_task' | |
set :domain, 'example.com' | |
set :app_name, 'APP_NAME' | |
set :repo, 'ssh://REPO' | |
namespace :deploy do | |
desc "Server setup" |
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
class Book < ActiveRecord::Base | |
attr_accessible :title, :author, :lang, :genre, :shelf_id | |
belongs_to :shelves | |
def enshelf shelf_id | |
@book.shelf_id = shelf_id | |
end | |
def unshelf | |
# setting shelf_id to nil means book is not on the shelf |
NewerOlder