Skip to content

Instantly share code, notes, and snippets.

Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
metacritical / Ruby Inheritance Doubt
Created Aug 30, 2011
My Doubts in ruby Inheritance let the Cat help us out.
View Ruby Inheritance Doubt
class Cat
def self.speak # this is a class method
puts "Meow"
class Lion < Cat
def roar
puts "Roar Roar !!!!" #now this is just an ordinary method.
metacritical / play.rb
Created Nov 28, 2011
Ruby video player implemented using HornetsEye
View play.rb
require 'rubygems'
require 'hornetseye_ffmpeg'
require 'hornetseye_xorg'
require 'hornetseye_alsa'
include Hornetseye
input = 'sintel.mp4'
alsa = 'default:0', input.sample_rate, input.channels
audio_frame = input.read_audio 600, :output => XVideoOutput do |display|
img =
metacritical / gist:1404985
Created Nov 29, 2011 — forked from seanlilmateus/gist:1386468
Macruby Face Detection in Mac OS X Lion
View gist:1404985
framework 'Cocoa'
framework 'QuartzCore'
class NSColor
def toCGColor
colorRGB = self.colorUsingColorSpaceName NSCalibratedRGBColorSpace
components ={}
colorRGB.getRed components[0], green:components[1], blue:components[2], alpha:components[3]
View csv_parser_csv_gem_benchmark.rb
require 'open-uri'
require 'nokogiri'
require 'parslet'
require 'csv'
# --------------------------------------------------
# Auxiliary code
class String
View gist:1418398
require 'spec_helper'
describe "Mock User object" do
let(:user) do
mock_model User, :find => "pankaj"
it "Should validate" do
#@user = User.find(1)
metacritical / widget.rb
Created Dec 8, 2011 — forked from maccman/widget.rb
MacRuby Webkit Interface
View widget.rb
framework "WebKit"
class Widget
class RPC
class << self
public :include
def initialize(widget)
@widget = widget
metacritical / .htaccess
Created Dec 9, 2011 — forked from BrandonMathis/.htaccess
sinatra htaccess for bluehost
View .htaccess
# 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 / gist:1663075
Created Jan 23, 2012
An Interactive menu in .bash_profile using shell script.
View gist:1663075
[[ -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
tput bold
tput setaf 3
case $i in
irb) irb --simple-prompt;;
metacritical /
Created Feb 4, 2012
Most Perfect Emacs 24 With Fullscreen patch build for Mac OSX SnowLeopard 10.6.8+ build script.
git clone git://
cd emacs
curl -O
patch -p1 -i feature-fullscreen.patch
cd ..
curl -O
tar -xzvf m4-1.4.13.tar.gz
cd m4-1.4.13
./configure --prefix=/usr/local
metacritical / gist:1773136
Created Feb 8, 2012
Some CGI dispatch file for use ...
View gist:1773136
require 'rubygems'
require 'fcgi'
ENV['RAILS_ENV'] ||= 'development'
ENV['GEM_HOME'] ||= '/home/user/.gems'
require 'rubygems'
require File.join(File.dirname(__FILE__), '../config/environment')