Skip to content

Instantly share code, notes, and snippets.

View neilmock's full-sized avatar

Neil Mock neilmock

View GitHub Profile

Ruby

Ruby is a dynamic, truly object-oriented language (everything is an object) that is also influenced in many ways from concepts found in functional programming. It open source, and was first released in 1995 by Yukihiro “matz” Matsumoto. The most current version is 1.9.1.

Language Overview

Here's a sample Ruby method to get started with syntax:

Python

Python is an interpreted, dynamically typed, object-oriented programming language. It is open-source, and was originally released in 1991 by Guido van Rossum.

Language Overview

Here's a sample Python method to get started with syntax:

from redis import Redis
r = Redis()
r.publish("greeting", "Neil")
@neilmock
neilmock / hack
Created August 7, 2010 23:07 — forked from ymendel/hack
#!/bin/sh
BRANCHES=`git branch`
if [ $? != 0 ]; then
exit
fi
GIT_SVN=0
git branch -r | grep 'git-svn' > /dev/null
if [ $? = 0 ]; then
GIT_SVN=1
EMACS = [
1,
2,
3,
]
EVERYONE_ELSE = [
1,
2,
3,
@neilmock
neilmock / gist:825842
Created February 14, 2011 13:04
roulette!
(ns roulette.core)
(defn spin []
(int (rand 38)))
(def *bankroll* (atom 1000))
(defn dobet
[bets]
(let [winner (spin)]
require "stateful"
class Folder < ActiveRecord::Base
include Stateful
# ...
stateful do
state :active
state :inactive
@neilmock
neilmock / rvm.rb
Created April 13, 2011 16:09
chef definition for rvm installation
define :rvm_install do
url = "https://rvm.beginrescueend.com/install/rvm"
bash "installing rvm stable" do
user params[:name]
code <<-EOH
bash < <(curl -B #{url})
EOH
not_if "which rvm"
end
@neilmock
neilmock / denvar.rb
Created April 23, 2011 16:59
denvar, envars in your data store.
module Denvar
def self.lookup key
@lookup.call key
end
def self.activate! &block
@lookup = block
class << ENV
alias :orig_lookup :[]
@neilmock
neilmock / .gitignore
Created June 22, 2012 12:03 — forked from karmi/.gitignore
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
node.json
tmp/