This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @foo xml | |
select @foo='<ext><name><first>Khaja</first><last>Minhajuddin</last></name><age>25</age></ext>'; | |
select @foo.value('(//ext/name/first)[1]','varchar(50)') 'First Name', | |
@foo.value('(//ext/name/last)[1]','varchar(50)') 'Last Name', | |
@foo.value('(//ext/age)[1]','integer') 'Age'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Script to create a jekyll blog post using a template. It takes one input parameter | |
# which is the title of the blog post | |
# e.g. command: | |
# $ ./new.rb "helper script to create new posts using jekyll" | |
# | |
# Author:Khaja Minhajuddin (http://minhajuddin.com) | |
# Some constants |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#This is a start script for nginx. Tested on Unbuntu Edge. | |
#Should work on Ubuntu, Debian and probably a few other Linux distros. | |
#Change DAEMON and CONFIG_FILE if neccessary | |
#Copied from: http://www.openmymind.net/2010/7/1/Installing-Nginx-with-Passenger-on-Linux | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/local/nginx/sbin/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["RAILS_ENV"] ||= "test" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support | |
require 'cucumber/rails/rspec' | |
require 'cucumber/rails/world' | |
require 'cucumber/web/tableish' | |
require 'capybara/rails' | |
require 'capybara/cucumber' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
God.watch do |w| | |
w.uid = "git" | |
w.gid = "git" | |
w.name = "asset-proxy" | |
w.pid_file = "/data/camouflage/tmp/camo.pid" | |
w.interval = 30.seconds | |
w.env = { | |
"PORT" => '8080', | |
"CAMOUFLAGE_KEY" => '0x24FEEDFACEDEADBEEFCAFE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream foobar_server { | |
# This is the socket we configured in unicorn.rb | |
server unix:/home/ubuntu/apps/foobar/tmp/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name *.foobar.com; | |
root /home/ubuntu/apps/foobar/public; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rackup | |
require File.expand_path('app', File.dirname(__FILE__)) | |
Ramaze.start(:file => __FILE__, :started => true) | |
run Ramaze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :rails_env, :production | |
set :unicorn_binary, "/usr/bin/unicorn" | |
set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do |