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 / 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)
# Adapted from a script by Evan Phoenix
require 'benchmark'
GC::Profiler.enable
class Simple
attr_accessor :next
end
top = Simple.new
@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).

@metacritical
metacritical / Gem_List_softweb
Created March 15, 2012 06:06
Gem List File on Softweb Linux Boxen
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.1.0, 3.0.9, 3.0.7, 2.3.11, 2.1.2)
actionpack (3.1.0, 3.0.12, 3.0.9, 3.0.7, 2.3.11, 2.1.2)
activemodel (3.1.0, 3.0.12, 3.0.9, 3.0.7)
activerecord (3.1.0, 3.0.9, 3.0.7, 2.3.11, 2.1.2)
activerecord-activesalesforce-adapter (2.0.0)
activeresource (3.1.0, 3.0.9, 3.0.7, 2.3.11, 2.1.2)
activesupport (2.3.11)
@metacritical
metacritical / gsl_dpkg
Created March 15, 2012 07:52
dpkg gep output
ii gsl-bin 1.15+dfsg-1 GNU Scientific Library (GSL) -- binary package
ii libgsl0-dev 1.15+dfsg-1 GNU Scientific Library (GSL) -- development package
ii libgsl0ldbl 1.15+dfsg-1 GNU Scientific Library (GSL) -- library package
;;; multi-select.el --- Provides multiple noncontiguous selections.
;; This file is NOT part of Emacs.
;; Copyright (C) 2005, Steve Yegge <steve.yegge at gmail dot com>
;; Parts Copyright (C) Lawrence Mitchell <wence@gmx.li>
;; Filename: multi-select.el
;; Version: 0.9 (pending XEmacs support for version 1.0)
;; Author: Steve Yegge <stevey at gmail dot com>
;; Created: April 10th 2005
class User < ActiveRecord::Base
attr_accessible :email, :firstname, :lastname, :password_hash, :password_salt , :password ,
:password_confirmation, :user_type
before_save :encrypt_password
attr_accessor :password
validates_confirmation_of :password
validates :email, presence: {:message => 'Email cannot be blank'}
@metacritical
metacritical / bf2asm.rb
Created August 27, 2012 05:09 — forked from ujihisa/bf2asm.rb
brainf**k compiler for 32bit X86 Linux
puts DATA.read
labelnum = 0
labelstack = []
ARGF.each_char do |c|
puts " # #{c}"
case c
when '>'
puts ' addl $4, %eax'
when '<'
@metacritical
metacritical / simple_args_parsing.sh
Created August 27, 2012 18:46 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@metacritical
metacritical / simple_args_parsing.sh
Created August 27, 2012 18:47 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"