Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@metacritical
metacritical / README.md
Created February 24, 2012 01:40 — forked from netmute/README.md
Game of Life

Game of Life

An implementation of Conway's Game of Life in 140 characters of Ruby.

Author

Created by Simon Ernst (@sier).

# Adapted from a script by Evan Phoenix
require 'benchmark'
GC::Profiler.enable
class Simple
attr_accessor :next
end
top = Simple.new
@metacritical
metacritical / Program Switch
Created February 9, 2012 21:46
Lets judge Which is better...
class Carpark
def initialize(arguments)
@program_mode = {true => Interactive,false => Filemode}[arguments].new
end
end
arg_params = ARGV.empty?
carpark = Carpark.new(arg_params)
V.S (versus)
@metacritical
metacritical / gist:1773136
Created February 8, 2012 20:24
Some CGI dispatch file for use ...
require 'rubygems'
require 'fcgi'
ENV['RAILS_ENV'] ||= 'development'
ENV['GEM_HOME'] ||= '/home/user/.gems'
require 'rubygems'
Gem.clear_paths
require File.join(File.dirname(__FILE__), '../config/environment')
@metacritical
metacritical / emacs24SNL10.6.8Fullscreen.sh
Created February 4, 2012 00:23
Most Perfect Emacs 24 With Fullscreen patch build for Mac OSX SnowLeopard 10.6.8+ build script.
git clone git://git.savannah.gnu.org/emacs.git
cd emacs
curl -O http://cloud.github.com/downloads/typester/emacs/feature-fullscreen.patch
patch -p1 -i feature-fullscreen.patch
cd ..
curl -O http://ftp.gnu.org/gnu/m4/m4-1.4.13.tar.gz
tar -xzvf m4-1.4.13.tar.gz
cd m4-1.4.13
./configure --prefix=/usr/local
make
@metacritical
metacritical / gist:1663075
Created January 23, 2012 13:18
An Interactive menu in .bash_profile using shell script.
[[ -s "/Users/pankajdoharey/.rvm/scripts/rvm" ]] && source "/Users/pankajdoharey/.rvm/scripts/rvm"
#PS1='\033[7h\033[37m\W ∑\033[0m\033[31m™\033[0m»'
echo "$(tput setaf 7)$(tput setab 1)Select an app:$(tput sgr0)"
tput setaf 3
select i in irb emacs macirb rubinius jruby node.js gnu-smalltalk gnu-lisp cmucl io-lang bash opt vim source
do
tput bold
tput setaf 3
case $i in
irb) irb --simple-prompt;;
@metacritical
metacritical / .htaccess
Created December 9, 2011 23:11 — forked from BrandonMathis/.htaccess
sinatra htaccess for bluehost
# General Apache options
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
#Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
@metacritical
metacritical / widget.rb
Created December 8, 2011 22:54 — forked from maccman/widget.rb
MacRuby Webkit Interface
framework "WebKit"
class Widget
class RPC
class << self
public :include
end
def initialize(widget)
@widget = widget
@metacritical
metacritical / gist:1418398
Created December 1, 2011 17:29
Just A mock file
require 'spec_helper'
describe "Mock User object" do
let(:user) do
mock_model User, :find => "pankaj"
end
it "Should validate" do
#@user = User.find(1)
#User.find(:all)
@metacritical
metacritical / csv_parser_csv_gem_benchmark.rb
Created November 29, 2011 15:39 — forked from bytesource/csv_parser_csv_gem_benchmark.rb
Simple CSV Parser vs. CSV Gem Benchmark
require 'open-uri'
require 'nokogiri'
require 'parslet'
require 'csv'
# --------------------------------------------------
# Auxiliary code
class String