Skip to content

Instantly share code, notes, and snippets.

View minhajuddin's full-sized avatar
⌨️
Beep boop, beep boop

Khaja Minhajuddin minhajuddin

⌨️
Beep boop, beep boop
View GitHub Profile
@minhajuddin
minhajuddin / basic-setup.sh
Created September 16, 2011 16:45
rails ubuntu setup script
#!/bin/bash
#script to install all the required software
#update the system
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get upgrade -y
#install required software
sudo apt-get install vim-gnome curl git-core bison build-essential zlib1g-dev libssl-dev libreadline6-dev libxml2-dev autoconf libxslt1-dev ctags gitk git-gui -y
@minhajuddin
minhajuddin / gist:1211076
Created September 12, 2011 11:42 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
@minhajuddin
minhajuddin / README.md
Created September 9, 2011 03:26
Rails initial setup checklist

Checklist for a rails app

  • Is email setup properly
  • New relic setup to recieve errors, performance stats, availability check.
  • Exception mailer wired up for exceptions
  • Wire up a settings library ( https://github.com/viatropos/cockpit or https://github.com/wycats/moneta or a simple settings file )
  • Wireup a few basic initializers containing extension methods for Strings, Time etc,. (create a gem for this?)
  • Setup capistrano
  • Setup foreman (with upstart export templates)
  • Setup logrotate for the production.log
@minhajuddin
minhajuddin / Hash.from_xml using Nokogiri
Created September 8, 2011 03:24 — forked from dimus/Hash.from_xml using Nokogiri
Adding Hash.from_xml method using Nokogiri
# USAGE: Hash.from_xml:(YOUR_XML_STRING)
require 'nokogiri'
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297
class Hash
class << self
def from_xml(xml_io)
begin
result = Nokogiri::XML(xml_io)
return { result.root.name.to_sym => xml_node_to_hash(result.root)}
@minhajuddin
minhajuddin / Prelude.cs
Created July 18, 2011 09:19 — forked from anonymous/Prelude.cs
Oh, you poor, poor imperative developers...
/* Prelude.cs : What happens when a haskell programmer learns C#.
Copyright (c) 2011 Clark Gaebel
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
@minhajuddin
minhajuddin / .bashrc
Created July 5, 2011 07:17 — forked from sborsje/.bashrc
Switch projects
PROJECT_PARENT_DIRS[0]="$HOME/code"
for PARENT_DIR in ${PROJECT_PARENT_DIRS[@]} ; do
if [ -d "$PARENT_DIR" ]; then
for PROJECT_DIR in $(/bin/ls $PARENT_DIR); do
if [ ! -z `which $PROJECT_DIR` ]; then
continue # don't set alias if there is something already a command on the path with the same name
fi
if [ -d "$PARENT_DIR/$PROJECT_DIR" ]; then
alias "$PROJECT_DIR"="cd $PARENT_DIR/$PROJECT_DIR"
@minhajuddin
minhajuddin / config.yml
Created July 1, 2011 09:59
Simple config
defaults: &defaults
default_from: [email protected]
cdn: false
development:
<<: *defaults
test:
<<: *defaults
@minhajuddin
minhajuddin / mirror_list_update.sh
Created June 30, 2011 22:30
update mirror list
#!/bin/bash
# Define tmpfile
tmpfile=/tmp/mirrorlisttmp
# Determine architecture type
archtype=$(uname -m)
# Get latest mirror list and save to tmpfile
wget -O $tmpfile "http://www.archlinux.org/mirrorlist/?country=United+States&protocol=ftp&protocol= \
@minhajuddin
minhajuddin / Procfile
Created June 27, 2011 18:58 — forked from czottmann/Procfile
Example of a Foreman/Capistrano/upstart setup
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler
@minhajuddin
minhajuddin / gist:1043322
Created June 23, 2011 19:03 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end