Skip to content

Instantly share code, notes, and snippets.

@strongwave
strongwave / nginx
Created September 22, 2011 04:59
nginx init.d file for start/stop/restart ...
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
# Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
### END INIT INFO
@strongwave
strongwave / nginx.conf
Created September 22, 2011 05:09
A typical /opt/nginx/conf/nginx.conf file
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /home/appuser/.rvm/gems/ruby-1.9.2-p290@rails3010/gems/passenger-3.0.9;
passenger_ruby /home/appuser/.rvm/wrappers/ruby-1.9.2-p290@rails3010/ruby;
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
@strongwave
strongwave / deploy.rb
Created September 23, 2011 21:27
deploy.rb file top for Capistrano Deployment with RVM
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2@rails3010'
set :rvm_type, :user # Don't use system-wide RVM
@strongwave
strongwave / ruby_install.sh
Created September 28, 2011 18:15
Install Ruby From Source
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz .
tar xvzf ruby-1.9.2-p290.tar.gz
cd ruby-1.9.2-p290
./configure; make; sudo make install
@strongwave
strongwave / rerun_passenger-install-apache-module.sh
Created September 28, 2011 18:37
run passenger-install-apache2-module in correct gem path to generate new .so file for apache2
export GEM_HOME=/home/YOUR_USER_NAME/YOUR_APP_NAME/shared/bundle/ruby/1.9.1/
cd $GEM_HOME;
cd gems/passenger-3.0.7/bin
./passenger-install-apache2-module
@strongwave
strongwave / httpd.conf
Created September 28, 2011 18:39
Edit /etc/httpd/conf/httpd.conf with passenger settings
LoadModule passenger_module /home/YOUR_USER_NAME/YOUR_APP_NAME/shared/bundle/ruby/1.9.1/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /home/YOUR_USER_NAME/YOUR_APP_NAME/shared/bundle/ruby/1.9.1/gems/passenger-3.0.7
PassengerRuby /usr/local/bin/ruby
@strongwave
strongwave / html5_example_page.html
Created September 29, 2011 23:21
Example of a simple html5 page
<!DOCTYPE html>
<html id="home" lang="en">
<head>
<title>
HTML5 tutorial - 1
</title>
</head>
<body>
....
</body>
@strongwave
strongwave / modernizr_include.html
Created September 29, 2011 23:38
Example of include modernizr in html5 page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dive Into HTML5</title>
<script src="modernizr.min.js"></script>
</head>
<body>
...
</body>
@strongwave
strongwave / ModernizerTest.js
Created September 30, 2011 00:18
Using Modernizer to Test Browser Html5 Support
/*
Author: Libo Cao Meyers
Date: 10/04/2011
Description: A javascript function that tests all modernizr supported html5/css3
features for current browser. Alert will tell user the supported
and non-supported feature for current browser. It contains a good
list of html5 tags as well.
*/
function testBrowserHtml5Support(){
@strongwave
strongwave / git_reset.sh
Created September 30, 2011 05:03
Git command to get rid of all local modifications
git reset --hard HEAD