Skip to content

Instantly share code, notes, and snippets.

View millisami's full-sized avatar
🎯
Focusing on landing a Web3 Job

Sachin Sagar Rai millisami

🎯
Focusing on landing a Web3 Job
View GitHub Profile
@millisami
millisami / add_lvhme.sh
Created December 18, 2016 09:34 — forked from mdespuits/add_lvhme.sh
Add lvh.me to Mac OS X hosts file
#!/bin/bash
main() {
if [[ $(has_lvh_me) == 1 ]]; then
echo 'lvh.me is already specified in your hosts file'
else
add_lvh_me
echo 'lvh.me was added to your hosts file!'
fi
flush_dns_cache
@millisami
millisami / wp-theme-review-setup.sh
Created December 13, 2016 09:47
Scaffold a new WordPress site using an Alfred workflow and WP-CLI. Development sites are spun up using Laravel Valet and a parked Sites folder in the root.
# Parse query name into theme and version variables (e.g. theme-name 1.0.0)
read theme version <<< "{query}"
# Create directory for new site
cd ~/Sites
mkdir $theme
cd $theme
# Download latest version of WordPress
wp core download
@millisami
millisami / hoodie-not_found.error
Created September 28, 2016 04:16
Error confirming user: Error: not_found
Initializing...
Using remote CouchDB: http://127.0.0.1:5984
Waiting for CouchDB [-*----] SUCCESS
WWW: http://127.0.0.1:6001
Admin: http://127.0.0.1:6002
Starting Plugin: 'hoodie-plugin-appconfig'
Starting Plugin: 'hoodie-plugin-email'
Starting Plugin: 'hoodie-plugin-users'
All plugins started.
@millisami
millisami / hoodie.error
Created September 27, 2016 20:49
Error: spawn EACCES
○ hoodie new appName -t "hoodiehq/hoodie-app-skeleton"
.d$b. .d$b. .d$$$$$$b. .d$$$$$$b. .d$$$$$$b. .d$b..d$$$$$$$$b.
$$$$$..$$$$$.$$$$$$$$$$$b .$$$$$$$$$$$b $$$$$$$$$$b $$$$$$$$$$$$$$$P'
$$$$$$$$$$$$d$$$$$$$$$$$$bd$$$$$$$$$$$$b$$$$$$$$$$$b$$$$$$$$$$$$$$$b.
$$$$$$$$$$$$Q$$$$$$$$$$$$PQ$$$$$$$$$$$$P$$$$$$$$$$$P$$$$$$$$$$$$$$$P'
$$$$$´`$$$$$'$$$$$$$$$$$$''$$$$$$$$$$$$'$$$$$$$$$$P $$$$$$$$$$$$$$$b.
'Q$P' 'Q$P' 'Q$$$$$$P' 'Q$$$$$$P' 'Q$$$$$$$P 'Q$P''Q$$$$$$$$P'
Version: 0.6.3 (node v0.12.15, npm 2.15.11, platform: darwin)
@millisami
millisami / application.js
Created January 23, 2015 11:30
Access configurable values in emberjs ember-cli
# app/adapters/application.js
import DS from 'ember-data';
import config from '../config/environment';
export default DS.ActiveModelAdapter.extend({
host: config.apiUrl
});
@millisami
millisami / emberjs-with-ember-cli.md
Last active August 29, 2015 14:04
Emberjs app using ember-cli

Building Contacto app using EmberCLI

Installation

First install Node.js. Then:

npm install -g bower
npm install -g phantomjs
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.10.5/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'ember-cli' ]
2 info using npm@1.2.18
3 info using node@v0.10.5
4 verbose read json /usr/local/share/npm/lib/package.json
5 verbose read json /usr/local/share/npm/lib/package.json
env = require 'config/environment'
if env.isDevelopment()
window.App.ApplicationAdapter = DS.RESTAdapter.extend({
host: 'http://localhost:3000'
})
else if env.isTest()
window.App.ApplicationAdapter = DS.FixtureAdapter.extend({
simulateRemoteResponse: false
})

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file: