This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
2010-08-12 #standup | |
The Practical Difference Between Function Statements and Function Expressions | |
jslint tells me this is illegal: | |
*/ | |
$(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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](); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Paperclip | |
class FixtureFile | |
def self.load(path) | |
@@spec_file_helper_file_descriptors ||= {} | |
@@spec_file_helper_file_descriptors[path] ||= | |
File.new(File.join(Rails.root, 'spec', 'fixtures', path)) | |
@@spec_file_helper_file_descriptors[path].rewind | |
return @@spec_file_helper_file_descriptors[path] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I want a list of 6 non-administrators who are not the | |
# current user only if someone is logged in. Otherwise, | |
# don't check current_user's id. | |
# instead of this: | |
if user_signed_in? | |
@other_users = User.non_admin.limit(6).where("name IS NOT NULL") | |
else | |
@other_users = User.non_admin.limit(6).where(['id != ?', @user.id]).where("name IS NOT NULL") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPAAA/+4ADkFkb2JlAGTAAAAAAf/b | |
AIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoKDBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxsc | |
Hx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f | |
Hx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgCbgMvAwERAAIRAQMRAf/EAMkAAAICAwEBAQAAAAAAAAAA | |
AAECAAMEBQYHCAkBAQEBAQEBAQEAAAAAAAAAAAACAQMEBQYHEAABAwIEAwQGBAcMBwUFBwUCAAED | |
EQQhMRIFQSIGUTITB2FxQlJiFIEjMwiRcoKyQ1MVobGS0iQ0dLQ1dRY3waLCY3OzJfBElNQY0fKD | |
01fik6MmNlYXVGSExFURAQEAAwACAQMBBgQEBAcBAAABEQIDEgQh8DEFE0FR0eEyFHGx8SKBkaFS | |
YZIjM8FCYnIkNBVT/9oADAMBAAIRAxEAPwDil7HkMGeCC93wUsQdSCwlgj4sgHKyERGq9VXWKUSl | |
mi2NxRquTvOglv8AbB61z3+xXqPTfe+Ki+V3+7lXQSPivE5ViF3kQrkyRqnXR0Ad65KQDLClUFCw | |
FAh5IpXUu1A4v6UCPmgxpnoNFTdVBlSiO+rSdS6ntmp2r3cVObFiX0Nfsio+p1Si6C4IJpKqJB9V |