Skip to content

Instantly share code, notes, and snippets.

@sharshenov
sharshenov / gist:2ce672c6e584b288d9cd
Last active August 29, 2015 14:05
Setup postfix gmail relay on ubuntu
# YOLO
sudo su
# Install postfix (use Internet Site configuration)
apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules
# Setup allowed SSL certs
cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | tee -a /etc/postfix/cacert.pem
# Add to /etc/postfix/main.cf
@sharshenov
sharshenov / gist:f4d05ed3a701133a3c35
Last active December 5, 2016 16:45
Nginx config for puma socket
upstream application {
server unix:/home/deploy/apps/APPNAME/shared/tmp/sockets/puma.sock fail_timeout=0;
}
# Optional redirect
#server {
# listen 80;
# server_name www.DOMAIN default;
# return 301 $scheme://DOMAIN$request_uri;
#}
@sharshenov
sharshenov / gist:965e71881f4e824797df
Last active August 29, 2015 14:04
Postgres setup
sudo apt-get install postgresql-9.3 postgresql-contrib
sudo -u postgres psql
create role USERNAME with password 'PASSWORD';
alter role USERNAME login;
create database DBNAME;
chain: function() {
collection.fetch()
whenFetched(collection,function() {
...
another_collection.fetch()
whenFetched(another_collection,function() {
...
});
);
},
@DanielApp.module "Entities", (Entities, App, Backbone, Marionette, $, _) ->
App.commands.setHandler "when:fetched", (entities, callback) ->
xhrs = _.chain([entities]).flatten().pluck("_fetch").value()
$.when(xhrs...).done ->
callback()