Skip to content

Instantly share code, notes, and snippets.

upstream <%= app_name %>_webservice {
<% nginx_ports.each do |port| %>
<%= "server 127.0.0.1:#{port}" %>;
<% end %>
}
server {
listen 80;
server_name <%= domain %>;
root <%= deploy_to %>/current/public;
@alvin2ye
alvin2ye / aa.js
Last active December 22, 2015 06:49
define(function(require, exports) {
/*! http://mths.be/placeholder v2.0.7 by @mathias */
;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){var l=this;l.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder');return l};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;if(m!=h.activeElement){e.call(m)}}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(
@alvin2ye
alvin2ye / .gemrc
Last active December 19, 2015 23:49 — forked from hamakn/.gemrc
# curl -sL https://gist.github.com/alvin2ye/6037403/raw/.gemrc > ~/.gemrc
gem: --no-ri --no-rdoc
:sources:
#- http://rubygems.org/
- http://production.s3.rubygems.org/
@alvin2ye
alvin2ye / gist:5654981
Last active December 17, 2015 18:39
nginx proxy conf
upstream __APP-NAME___web_services {
server 127.0.0.1:__APP-PORT__;
}
server {
listen __NGINX-PORT__;
server_name __NGINX-NAME__;
root __APP-PATH__/public;
gzip on;
# Apt-install various things necessary for Ruby, guest additions,
# etc., and remove optional things to trim down the machine.
apt-get -y update
apt-get -y remove apparmor
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev libssl-dev openssl libreadline5-dev
apt-get clean
# Remove this file to avoid dhclient issues with networking
rm -f /etc/udev/rules.d/70-persistent-net.rules
# run with: god -c /path/to/config.god [add -D if you want to not-deamonize god]
# This is the actual config file used to keep the delayed_job running
APPLICATION_ROOT = "/var/www/application"
RAILS_ENV = "production"
God.watch do |w|
w.name = "delayed_job_production"
w.interval = 15.seconds
w.start = "/bin/bash -c 'cd #{APPLICATION_ROOT}/current; /usr/bin/env RAILS_ENV=#{RAILS_ENV} #{APPLICATION_ROOT}/current/script/delayed_job start > /tmp/delay_job.out'"
forfiles /P "xxx\xvtdata" /M *.* /S /D -100 /C "cmd /c echo @path && del /q @path"
pause
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
clear
CUR_DIR=$(pwd)
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this script!"
exit 1
default: &default
adapter: mysql2
encoding: utf8
host: localhost
username: root
password: ""
development:
<<: *default
database: xxx_dev
#!/bin/bash
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
mkdir ~/.rbenv/plugins
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bash_profile
echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
source $HOME/.bash_profile
CONFIGURE_OPTS="--no-tcmalloc" rbenv install ree-1.8.7-2012.02