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
class QuestionsController < RestfulController | |
model Question | |
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
class Piano < Widget | |
def initialize opts = {}, &action | |
opts = {:width => 700, :height => 100}.merge opts | |
@action = action | |
key_width = opts[:width] / 52.0 | |
ivory = {:bottom => 0, :width => key_width.round, :height => opts[:height] * 2 / 5} | |
ebony = {:top => 0, :width => (key_width * 2 / 3).round, :height => opts[:height] * 3 / 5} | |
last_x = -key_width |
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
-- this version doesn't need prototype.lua | |
BarGraph = { | |
x = 0, y = 20, | |
width = 20, height = 100, | |
offset = 0, | |
update = | |
function (self, t) | |
self.height = 60 + 40 * math.sin(self.offset * math.pi / 10 + t / 10) | |
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
Plank = {} | |
Plank.new = function(world, x, y, w, h, offset) | |
body = love.physics.newBody(world, 0, 0, 0) | |
body:setAngularDamping(1000) | |
shape = love.physics.newRectangleShape(body, x, y, w, h) | |
body:setMassFromShapes() | |
return { | |
shape = shape, body = body, offset = offset, | |
force = | |
function(self, t) |
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
Glaukopis-Athena:Desktop d$ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -S -o ben.arm -arch arm -I/usr/include ben.c | |
In file included from /usr/include/sys/_types.h:33, | |
from /usr/include/_types.h:27, | |
from /usr/include/stdio.h:64, | |
from ben.c:1: | |
/usr/include/machine/_types.h:36:24: error: arm/_types.h: No such file or directory | |
In file included from /usr/include/_types.h:27, | |
from /usr/include/stdio.h:64, | |
from ben.c:1: | |
/usr/include/sys/_types.h:94: error: syntax error before ‘__darwin_blkcnt_t’ |
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
@interface NSData (NSData_HexAdditions) | |
- (NSData *)dataFromHexString; | |
@end | |
#define IS_HEX(c) ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >='A' && c <= 'F')) | |
@implementation NSData (NSData_HexAdditions) | |
/* | |
* Takes an NSData encoding an ASCII string representing hexadecimal data, |
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 | |
# Solve a Joel problem | |
def chain k | |
s, c, l = k, 0, [] # start, carry, digit list | |
begin | |
l.unshift k | |
d = 2 * k + c | |
c, k = d / 10, d % 10 |
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
#include <iostream> | |
void handle_note_off(void * channel, void * note, void * velocity); | |
class RadMidi { | |
public: | |
void handleNoteOff(unsigned int channel, unsigned int note, unsigned int velocity) | |
{ | |
handle_note_off(&channel, ¬e, &velocity); | |
} |
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
## Implementation | |
class FormBuilder | |
def initialize obj, ctx | |
@obj, @ctx = obj, ctx | |
end | |
def method_missing m, *args | |
@ctx.send(m, @obj, *args) | |
end | |
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
Glaukopis-Athena:Desktop d$ mkdir hgcase | |
Glaukopis-Athena:Desktop d$ cd hgcase | |
Glaukopis-Athena:hgcase d$ hg init | |
Glaukopis-Athena:hgcase d$ touch foo.txt | |
Glaukopis-Athena:hgcase d$ hg st | |
? foo.txt | |
Glaukopis-Athena:hgcase d$ hg add foo.txt | |
Glaukopis-Athena:hgcase d$ hg commit -m "foo" | |
Glaukopis-Athena:hgcase d$ hg rm foo.txt | |
Glaukopis-Athena:hgcase d$ touch FOO.txt |
OlderNewer