Skip to content

Instantly share code, notes, and snippets.

@pjaspers
pjaspers / DefaultKeyBinding.dict
Created April 26, 2011 07:42
A copy of my ~/Library/KeyBindings/DefaultKeyBinding.dict, pretty much copied off of @boredzo
{
/* Modifier keys: start with C-m */
"^m" = {
"^ " = ("insertText:", "\U2423"); /* C-space space */
/*This one added by boredzo.*/
"
" = ("insertText:", "\U23CE"); /* CR return */
/*These two modified by boredzo. 23CE was previously 21A9, and both were previously on e rather than r.*/
"^r" = ("insertText:", "\U23CE"); /* C-r return */
@pjaspers
pjaspers / caveatpatchor.js
Created April 11, 2011 05:52
With Flickr support
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
Waarom geen vliegtuigen?
- Vliegtuigen zijn gevaarlijk. Een ernstige ramp kan nooit worden uitgesloten.
- Er is geen veilige oplossing voor tijdens het neerstorten
- Vliegen is overbodig want de alternatieven zijn beschikbaar. Het is een kwestie van keuzes maken.
- Vliegtuigen werken het gebruik van atoomwapens in de hand.
Of
Waarom geen kernenergie?
ldfsljksfdlkj
# Source: http://twitter.com/rentzsch/status/11677309429874688
curl -o ~/Library/Sounds/inception.mp3 http://inception.davepedu.com/inception.mp3 && defaults write com.apple.Xcode PBXBuildFailureSound ~/Library/Sounds/inception.mp3
- (void)liveRequest:(ASIHTTPRequest *)request didReceiveData:(NSData *)data {
NSString *aString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(\\{.*?\\})"options:NSRegularExpressionCaseInsensitive error:&error];
[regex enumerateMatchesInString:aString options:0 range:NSMakeRange(0, [aString length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
//DLog(@"Our Range %@", NSStringFromRange(match.range));
//DLog(@"Text %@", [aString substringWithRange:match.range]);
[Parser parserWithResponse:[aString substringWithRange:match.range] delegate:self andRequest:request];
}];
}
#!/usr/bin/ruby
# update_version.rb
#
# Created by Piet Jaspers on 23/07/10.
# Copyright 2010 10to1. All rights reserved.
require "rubygems"
require "Plist"
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif
#ifdef DEBUG
#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
#define DLog(...) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS
@pjaspers
pjaspers / xauth.sh
Created May 20, 2010 19:55
An attempt to do xauth in a shell script.
function xauth(){
NONCE=`head -n 64 /dev/urandom | env LC_CTYPE=C tr -dc 0-9 | cut -c1-64`
TIMESTAMP=`date +%s`
# signature base string
# POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Faccess_token&oauth_consumer_key%3Dri8JxYK2ZdwSV5xIUfNNvQ%26oauth_nonce%3DqfQ4ux5qRH9GaH8tVwDCwInLy6z8snR6wiq8lKcD6s%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1267817662%26oauth_version%3D1.0%26x_auth_mode%3Dclient_auth%26x_auth_password%3Dxyz12242134%26x_auth_username%3Depisod
consumer_key="6tV0bqiCWFPVQDSqUW6kMw"
consumer_secret="wnqkvIv9AMeeFoWJttIhRXxPQNewRXNs2bAYa6j8U"
key="${consumer_secret}&"
@pjaspers
pjaspers / jelle.rb
Created May 11, 2010 08:14
Getting @fousa's standing in the gliding competition
#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
require 'hpricot'
doc = open("http://www.lvzc.be/charronline/2010/klassement_benelux.php?list=standaard") { |f| Hpricot(f) }
def print_nicely(tr)
current_standing = tr.at("td:nth(0)").inner_html
name = tr.at("td:nth(1)").inner_html