Skip to content

Instantly share code, notes, and snippets.

View abachman's full-sized avatar
🙌
good times

Adam Bachman abachman

🙌
good times
View GitHub Profile
# Arcify
class Arcify < Processing::App
class Arc
attr_accessor :id
def initialize x,y,r,s,f,i
@x = x
@y = y
@r = r
@s = s
@abachman
abachman / treelike.rb
Created June 18, 2010 00:40
livecoding practice 2010-06-17
# Treelike
# livecoding practice, 2010-06-17, 40min
# going for something like a tree. This isn't exactly what I
# saw in my brain when I started, but it's interesting.
# especially when the @d value starts getting very small.
# image at http://www.flickr.com/photos/16913236@N04/4710032223/
class Treelike < Processing::App
class Leaf
@abachman
abachman / treelike.rb
Created June 18, 2010 00:36
treelike - livecoding practice
We couldn’t find that file to show.
@abachman
abachman / blankslate.rb
Created June 18, 2010 00:39
livecoding practice starting point
# Blankslate - livecoding practice start file
class Blankslate < Processing::App
def setup
end
def draw
@abachman
abachman / pom.rb
Created June 18, 2010 16:55 — forked from ngauthier/pom.rb
pomodoro timer
#!/usr/bin/env ruby
def notify(msg)
puts "[#{ Time.now.strftime "%H:%M:%S" }]: #{msg}"
`notify-send -i /home/adam/Documents/images/icons/pomodoro.png "Pomodoro" "#{msg}"`
end
POMODORO = ARGV.size > 0 ? ARGV[0].to_i : 25
REST = ARGV.size > 1 ? ARGV[1].to_i : 5
if ARGV.length > 2
# Circle Grid
# https://picasaweb.google.com/adam.bachman/LivecodePractice20100618
require 'ostruct'
class CircleGrid < Processing::App
def setup
background 255
ellipse_mode CENTER
stroke_width 20
frame_rate 30
@abachman
abachman / better-ruby-idioms.rb
Created July 28, 2010 15:32
Simpler, idiomatic Ruby for extending Rails
# Simpler, idiomatic Ruby for extending Rails.
#
# http://yehudakatz.com/2009/11/12/better-ruby-idioms/
#
module Yaffle
# any method placed here will apply to classes, like Hickwall
def acts_as_yaffle
send :include, InstanceMethods
end
@abachman
abachman / scoped_javascript_function_definitions.js
Created August 12, 2010 17:54
The Practical Difference Between Function Statements and Function Expressions
/*
2010-08-12 #standup
The Practical Difference Between Function Statements and Function Expressions
jslint tells me this is illegal:
*/
$(function () {
- form_for @screen do |f|
- Asset.all.each do |asset|
%label
= check_box_tag 'screen[asset_ids][]', asset.id, @screen.asset_ids.include?(asset.id)
= asset.name
= f.submit
@abachman
abachman / functions-are-not-closures.js
Created August 24, 2010 19:22
javascript functions are not closures.
// javascript functions are not closures. They do not behave in the way I would expect.
var funcs = [];
for (var i=0; i < 10; i++) {
funcs.push(function() { document.writeln(i); });
}
for (var n=0; n < 10; n++) {
funcs[n]();
}