Skip to content

Instantly share code, notes, and snippets.

@agmcleod
agmcleod / dictionary.txt
Created May 7, 2012 23:00
numbers dictionary
1,one
2,two
3,three
4,four
5,five
6,six
7,seven
8,eight
9,nine
10,ten
@agmcleod
agmcleod / Gemfile
Created May 9, 2012 15:04
Jasmine Example
source 'http://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'# , '~> 0.2.7'
gem 'devise' #, '~> 1.1.3'
@agmcleod
agmcleod / gist:2648020
Created May 9, 2012 19:01
Waterloo math problem

Problem S4: A Coin Game

Problem Description

When she is bored, Jo Coder likes to play the following game with coins on a table. She takes a set of distinct coins and lines them up in a row. For example, let us say that she has a penny (P, worth $0.01), a nickel (N, worth $0.05), and a dime (D, worth $0.10). She lines them up in an arbitrary order, (for example, D N P), and then moves them around with the goal of placing them in strictly increasing order by value, that is P N D (i.e., $0.01, $0.05, $0.10). She has particular rules that she follows:

  • The initial coin line-up defines all positions where coins can be placed. That is, no additional positions can be added later, and even if one of the positions does not have a coin on it at
@agmcleod
agmcleod / site.css
Created May 9, 2012 21:13
scss example for friend
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
@agmcleod
agmcleod / example.rb
Created July 4, 2012 00:01
Getting nil for a variable in one case but not another.
# player is in attr_accessor call inside the class.
# no error thrown
def render(gc, sbg, g)
@player.graphic
draw_surfaces
g.translate offset_x, offset_y
end
# (NoMethodError) undefined method `+' for nil:NilClass
@agmcleod
agmcleod / test.rb
Created September 7, 2012 19:55
meta programming/inflector test
require 'rubygems'
require 'active_support/all'
class MyClass
def skills
[]
end
def unions
[]
end
@agmcleod
agmcleod / timer-melonjs.js
Created December 6, 2012 15:35
Timer example melonjs
App = {
load: function() {
if(!me.video.init("app", 800, 600, false, 1.0)) {
alert("Your browser does not support the canvas.");
return;
}
me.loader.onload = this.loaded.bind(this);
me.loader.preload([]);
me.state.change(me.state.LOADING);
@agmcleod
agmcleod / test.rb
Created December 7, 2012 00:56
jruby argv with gets example
p ARGV
t = gets
puts t
if window["Game"] == null || typeof window["Game"] == "undefined"
Game = {}
App = {
init: ->
if !me.video.init("app", 640, 480, false, 1)
alert "your browser does not support the canvas"
resources = [{
name: "metatiles32x32",
@agmcleod
agmcleod / .bashrc
Last active December 10, 2015 21:18
Configuration files & settings
PATH=$PATH:$HOME/bin
PATH=/usr/local/bin:$PATH
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
alias vu='vagrant up'
alias vs='vagrant status'
alias vsp='vagrant suspend'
alias vr='vagrant resume'
alias vssh='vagrant ssh'