Skip to content

Instantly share code, notes, and snippets.

gareth-townsends-macbook-air:formtastic quamen$ gem list | grep rspec
dchelimsky-rspec (1.1.12, 1.1.11.6, 1.1.11.4, 1.1.11.3, 1.1.11.2)
rspec (1.1.12, 1.1.11)
rspec-rails (1.1.12, 1.1.11)
rspec_hpricot_matchers (1.0)
@quamen
quamen / gist:59047
Created February 5, 2009 22:09 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
Note: UK People start here: http://twitter.com/timmeh/status/1351833678
HOW TO ENABLE TETHERING ON YOUR 3.0 iPHONE
Step 1: Check if you own a 3G iPhone. If you're on EDGE (as I am): sorry. Tethering does not seem to work with EDGE phones.
Step 2: Check to see if AT&T is your carrier. If it is: sorry. AT&T will not let you tether.
Step 3: Navigate to ~/Library/iTunes/iPhone Carrier Support. Notice the spaces in that last folder name! If you're at the command line, use backslashes to escape the spaces, i.e. cd ~/Library/iTunes/iPhone\ Carrier\ Support. You will find a file with an ipcc extension. Copy that file: e.g. cp foo.ipcc foo.ipcc.original. This creates a backup for when you mess up.
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
splashView.image = [UIImage imageNamed:@"Default.png"];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:window cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
splashView.alpha = 0.0;
-(IBAction)didPressButtonInTableCell:(MyButton*)sender {
NSIndexPath *indexPath = [tableView indexPathForCell:(MyCell *)sender.superview];
[self tableView:tableView didSelectRowAtIndexPath:indexPath];
}
-(IBAction)didPressButtonInTableCell:(MyButton*)sender {
for (int i = 0; i < [anArrayOfKeys count]; i++) {
if ([[anArrayOfKeys objectAtIndex:i] isEqualToString:sender.key]) {
[self tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
}
}
}
-(IBAction)didPressButtonInTableCell:(MyButton*)sender {
NSUinteger index = 0;
for (MyKeyObject *aKey in anArrayOfKeys) {
if ([aKey isEqualToString:sender.key]) {
[self tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]];
}
index++;
}
}
@quamen
quamen / gist:558365
Created August 31, 2010 01:22 — forked from NZX/gist:558363
class Robot
def self.rock!
system(%(osascript -e 'tell application "iTunes" to play track named "Robot Rock"'))
end
end
@quamen
quamen / capybara
Created October 21, 2010 05:26
write a step that uses the post method and store the response, access it in a later step
@response = post(
"my/awesome/url",
json_content,
{"Content-Type" => "application/json"}
)
@quamen
quamen / e23.erl
Created November 17, 2010 08:20
Timing Code
-module (e21).
-compile (export_all).
ringBenchmark(NumberOfNodes, _Message, NumberOfLaps) ->
statistics(runtime),
statistics(wall_clock),
{_, Time1} = statistics(runtime),
{_, Time2} = statistics(wall_clock),
io:format("Sent ~p messages in time=~p (~p) milliseconds~n", [NumberOfLaps * NumberOfNodes, Time1, Time2]).