Skip to content

Instantly share code, notes, and snippets.

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@plagi
plagi / ledes.rb
Created June 26, 2012 14:06 — forked from mischa/ledes.rb
require 'rubygems'
require 'stemmer'
require 'classifier'
class LedeClassifier
attr :classifier
def initialize(sections, n)
@classifier = Classifier::Bayes.new(*sections)
@plagi
plagi / blog_backbone_style.md
Created June 24, 2012 01:49 — forked from liammclennan/blog_backbone_style.md
Backbone.js Style / Patterns

Backbone.js Style and Patterns

Naming Rules

Use PascalCase for constructors, namespaces and modules:

var m = new Backbone.Model(); 
@plagi
plagi / erb_2_haml.sh
Created March 20, 2012 23:39 — forked from makokal/erb_2_haml.sh
script to convert erb to HAML for a whole project
#!/bin/bash
for i in `find . -name '*.erb'` ; do
html2haml $i `echo $i | sed 's/\.erb/\.haml/'`
done
find . -name '*.erb' -exec rm \{\} \;
@plagi
plagi / app.coffee
Created February 6, 2012 21:51 — forked from jmreidy/app.coffee
Backbone.js Loading notification
activeRequests = []
Backbone._sync = Backbone.sync
Backbone.sync = (method, model, options) ->
asyncToken = Backbone._sync.apply(this,arguments)
asyncToken.then () ->
activeRequests = _.without activeRequests, asyncToken
if activeRequests.length == 0 then console.log "LOADING COMPLETE"
if activeRequests.length == 0
console.log "START LOADING"
@plagi
plagi / _pay_form.erb.html
Created September 23, 2011 11:45 — forked from vol4ok/_pay_form.erb.html
rails + robokassa example
<form action="<%= @pay_desc['mrh_url'] %>" method="post">
<input type=hidden name=MrchLogin value="<%= @pay_desc['mrh_login'] %>">
<input type=hidden name=OutSum value="<%= @pay_desc['out_summ'] %>">
<input type=hidden name=InvId value="<%= @pay_desc['inv_id'] %>">
<input type=hidden name=Desc value="<%= @pay_desc['inv_desc'] %>">
<input type=hidden name=SignatureValue value="<%= @pay_desc['crc'] %>">
<input type=hidden name=Shp_item value="<%= @pay_desc['shp_item'] %>">
<input type=hidden name=IncCurrLabel value="<%= @pay_desc['in_curr'] %>">
<input type=hidden name=Culture value="<%= @pay_desc['culture'] %>">
<input type=submit value='Оплатить'>