Skip to content

Instantly share code, notes, and snippets.

@pjaspers
pjaspers / gist:3258692
Created August 4, 2012 16:29 — forked from protocool/gist:2048775
Propane caveatPatchor.js snippet to display Instagram images inline
var displayInstagramImages = true;
if (displayInstagramImages) {
Campfire.InstagramExpander = Class.create({
initialize: function(chat) {
this.chat = chat;
var messages = this.chat.transcript.messages;
for (var i = 0; i < messages.length; i++) {
this.detectInstagramURL(messages[i]);
@pjaspers
pjaspers / babbelaar.rb
Created July 24, 2012 18:17
Small script that spits some nonsense into a room on Campfire.
#! /usr/bin/env ruby
#
# Small script that spits some nonsense into a room on Campfire.
#
# Usage:
#
# ruby ~/path/to/babbelaar.rb campfire_token
#
# Where campfire_token is your [token](https://10to1.campfirenow.com/member/edit).
# It will keep talking until you quit it with Control-C
@pjaspers
pjaspers / Gemfile
Created July 20, 2012 21:20
Simple Sinatra app that uses the buienradar.nl api's and returns json(p) results
source :rubygems
gem "sinatra"
gem "rack-contrib"
@pjaspers
pjaspers / gist:3121827
Created July 16, 2012 09:35
Pukkelpop playlist creator
#! /Users/pjaspers/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
# -*- coding: utf-8 -*-
# (The spotify gem requires ruby 1.9.3)
#
# The [Hallon-gem](https://github.com/Burgestrand/Hallon/) for all things Spotify
require "hallon"
# Get an application key from Spotify (the binary kind), from [here](https://developer.spotify.com/en/libspotify/application-key/)
# The binary kind.
session = Hallon::Session.initialize(IO.read("./spotify_appkey.key"))
def xcode_proj_name
File.basename(Dir.glob("*.xcodeproj").first, ".xcodeproj")
end
desc "Reset Xcode's autocompletion"
task :reset_xcode do
home_folder = File.expand_path("~")
project_name = xcode_proj_name
Dir.glob("#{home_folder}/Library/Developer/Xcode/DerivedData/#{project_name}*").each do |folder_path|
puts "Deleting #{folder_path}"
@pjaspers
pjaspers / gist:1766661
Created February 8, 2012 08:08
Core Data Date type
# Returns a nicely formatted datestring instead of core data's weird datetype.
function cddate() {
ruby -e "puts Time.at(Time.gm("2001", "01", "01").to_i + $1)"
}
//
// Speciaal voor Inferis
// YES nil N
//Met ifs 0.452217
//Met statement 0.430586
//#######################
//
//NO nil N
//Met ifs 0.451592
@pjaspers
pjaspers / De ideale snoepzak
Created August 4, 2011 08:27
De ideale snoepzak
- Gesuikerde kersen
- Zuurtjes
- spiegeleitjes
- zure matten.
- smurfen
- van die grote platte aardbeien
- poepegatjes.
- smoelentrekkers
- Neuzen (echte!)
- Mariakes
# setup
target = UIATarget.localTarget()
app = target.frontMostApp()
window = app.mainWindow()
# Some handy functions
dlog = (message) -> UIALogger.logDebug message
log = (message) -> UIALogger.logMessage message
should = (message) -> UIALogger.logStart "should #{message}"
fail = (message) -> UIALogger.logFail message
@pjaspers
pjaspers / gist:1083277
Created July 14, 2011 19:48
iPad check
// A check to see if we're running on an iPad.
// Blatantly picked up from: http://cocoawithlove.com/2010/07/tips-tricks-for-conditional-ios3-ios32.html
static inline BOOL IsIPad() {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] &&
[[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
return YES;
}
else