Skip to content

Instantly share code, notes, and snippets.

View jmeridth's full-sized avatar
:shipit:
coding

Jason Meridth jmeridth

:shipit:
coding
View GitHub Profile
module MyModule
def my_method; 'hello' ; end
end
class MyClass
class << self
include MyModule
end
end
@jmeridth
jmeridth / coworker_having_fun_at_my_expense.cs
Created March 12, 2010 02:13
funny c# object hierarchy
public abstract class AbstractJMClassFactory
{
public abstract AbstractJMClass CreateHappyJM();
public abstract AbstractJMClass CreateAngryJM();
public abstract AbstractJMClass CreateHungryJM();
}
public class ConcreteJMClassFactory: AbstractJMClassFactory {
public override AbstractJMClass CreateHappyJM()
{
@jmeridth
jmeridth / cruise_control_rb_post_receive_hook.rb
Created March 15, 2010 19:20
git post_recieve hook to call CC.rb
#!/usr/bin/env ruby
while (input = STDIN.read) != ''
rev_old, rev_new, ref = input.split(" ")
if ref == "refs/heads/master"
url="https://user:[email protected]/projects/build/project_name"
puts "Run CI build for project_name application"
`wget --no-check-certificate #{url} > /dev/null 2>&1`
@jmeridth
jmeridth / class_variables.rb
Created March 18, 2010 01:51
ruby object model class variables
@@test = 20
class A
@@a = 1
def self.a
@@a
end
def hello
puts "hello from A"
@jmeridth
jmeridth / git_revert_after_merge.txt
Created March 24, 2010 02:58
git revert after merge
~/test > git init && touch hello && git add hello && git commit -m "add hello" && touch hello2 && git add hello2 && git commit -m "add hello2" && touch hello3 && git add hello3 && git commit -m "add hello3" && git checkout -b otherbranch && touch hello4 && git add hello4 && git commit -m "add hello4" && touch hello5 && git add hello5 && git commit -m "add hello5"
Initialized empty Git repository in /Users/jmeridth/test/.git/
[master (root-commit) 58ec117] add hello
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello
[master c295b30] add hello2
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello2
[master 4d9730e] add hello3
0 files changed, 0 insertions(+), 0 deletions(-)
@jmeridth
jmeridth / install_gistosis.txt
Created April 2, 2010 04:52
install gitosis output
running install
running bdist_egg
running egg_info
creating gitosis.egg-info
writing requirements to gitosis.egg-info/requires.txt
writing gitosis.egg-info/PKG-INFO
writing top-level names to gitosis.egg-info/top_level.txt
writing dependency_links to gitosis.egg-info/dependency_links.txt
writing entry points to gitosis.egg-info/entry_points.txt
writing manifest file 'gitosis.egg-info/SOURCES.txt'
@jmeridth
jmeridth / hobby_suggestions.rb
Created April 9, 2010 16:19
hobby suggestions in ruby
case suggested_hobby.suggested_by
when "Joe Ocampo"
raise "Hobby requirement met with reading code, no others necessary"
when wife
try_once_to_appease_and_move_on
else
raise "No thanks"
end
@jmeridth
jmeridth / deploy.rb
Created June 21, 2010 19:08
capistrano deploy.rb
set :user, "username_on_slice"
set :domain, "mydomain.com"
set :application, "my_app_name"
default_run_options[:pty] = true
set :repository, "[email protected]:my_app_name.git"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
@jmeridth
jmeridth / number_of_one_bits.py
Created July 23, 2010 16:38
get the number of one bits in a number (python)
def num_of_one_bits(num):
total = 0
bits = ""
while(num > 0):
bits += str(num&1)
total += num&1
num>>=1
return total,bits
number = input("Please give an integer: ")
@jmeridth
jmeridth / .gitconfig
Created August 19, 2010 13:21
.gitconfig
[user]
name = armmer
email = um...no
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow