Skip to content

Instantly share code, notes, and snippets.

View kamal-github's full-sized avatar
:octocat:
Focusing

Kamal Namdeo kamal-github

:octocat:
Focusing
View GitHub Profile
@kamal-github
kamal-github / database.yml
Created December 19, 2014 15:48
database.yml for memory realive
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
@kamal-github
kamal-github / app_name
Created November 19, 2015 15:10 — forked from zacksiri/app_name
nginx config
upstream unicorn {
server unix:/tmp/unicorn.app_name.sock fail_timeout=0;
}
server {
server_name domain.com www.domain.com;
listen 80 default deferred;
root /opt/apps/app_path/public;
@kamal-github
kamal-github / unicorn.rb
Created November 19, 2015 15:11 — forked from zacksiri/unicorn.rb
unicorn.rb
# Sample verbose configuration file for Unicorn (not Rack)
#
# This configuration file documents many features of Unicorn
# that may not be needed for some applications. See
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
# for a much simpler configuration file.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.

Postgres

Configure so that the vagrant user doesn't need to provide username and password.

apt-get -yqq install postgresql postgresql-contrib-9.3 libpq-dev postgresql-server-dev-9.3
su - postgres
createuser --createdb --superuser -Upostgres vagrant
psql -c "ALTER USER vagrant WITH PASSWORD 'password';"
psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;"

psql -c "create database discourse_test owner vagrant encoding 'UTF8' TEMPLATE template0;"

## Postgres
Configure so that the vagrant user doesn't need to provide username and password.
apt-get -yqq install postgresql postgresql-contrib-9.3 libpq-dev postgresql-server-dev-9.3
su - postgres
createuser --createdb --superuser -Upostgres vagrant
psql -c "ALTER USER vagrant WITH PASSWORD 'password';"
psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner vagrant encoding 'UTF8' TEMPLATE template0;"
## Postgres
Configure so that the vagrant user doesn't need to provide username and password.
apt-get -yqq install postgresql postgresql-contrib-9.3 libpq-dev postgresql-server-dev-9.3
su - postgres
createuser --createdb --superuser -Upostgres vagrant
psql -c "ALTER USER vagrant WITH PASSWORD 'password';"
psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner vagrant encoding 'UTF8' TEMPLATE template0;"

RVM and Ruby

apt-get -yqq install libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config curl build-essential git

su - vagrant -c "sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)"
adduser vagrant rvm
source /etc/profile.d/rvm.sh
su - vagrant -c "rvm pkg install libyaml"
su - vagrant -c "rvm install 2.0.0-turbo"

su - vagrant -c "rvm use 2.0.0-turbo --default"

@kamal-github
kamal-github / nginx-ssl-config
Created February 9, 2016 17:42 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@kamal-github
kamal-github / nginxproxy.md
Created February 9, 2016 17:43 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@kamal-github
kamal-github / jquery validate customization
Last active March 31, 2016 10:49
jquery validate plugin - different trick when customizing
1) If you don't want to show error message -
`$('#form').validate({
errorPlacement: function(error,element) {
return true;
}
});`
`http://stackoverflow.com/questions/1578007/jquery-validate-hide-display-validation-error-messages-show-custom-errors`