Skip to content

Instantly share code, notes, and snippets.

View neilmock's full-sized avatar

Neil Mock neilmock

View GitHub Profile
@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 / 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
require "stateful"
class Folder < ActiveRecord::Base
include Stateful
# ...
stateful do
state :active
state :inactive
@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)]
EMACS = [
1,
2,
3,
]
EVERYONE_ELSE = [
1,
2,
3,
@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
from redis import Redis
r = Redis()
r.publish("greeting", "Neil")

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:

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:

#!/bin/bash
sudo su -
#
# Audio: fix ubuntu 9.04 broken sound
#
apt-get install build-essential xmlto libncurses5-dev
export ALSA="1.0.20"