Skip to content

Instantly share code, notes, and snippets.

require 'build_idioms/webos'
BuildIdioms::WebOS.mojo_application \
:sources_path => 'stylematters'
# examples:
# if at includes/idioms/webos.rb:
# rake -Iincludes build
# rake -Iincludes clean
# rake -Iincludes run
if (!ILabs.DraggableBehavior) {
ILabs.DraggableBehavior = function(element) {
var originalTransform;
var originalX, originalY;
var self = {};
function handleDragStart(e) {
originalTransform = new WebKitCSSMatrix(window.getComputedStyle(element).webkitTransform);
originalX = Event.pointerX(e.move);
//
// ILTelemetry.h
// Telemetry
//
// Created by ∞ on 21/06/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#define ILAssertNoNSError(errVarName, call) \
{ \
NSError* errVarName; \
if (!(call)) \
[NSException raise:@"ILUnexpectedNSErrorException" format:@"Operation " #call " failed with error %@", errVarName]; \
}
#!/usr/bin/env ruby
require 'osx/cocoa'
require 'optparse'
include OSX
$service_name = nil
$service_port = nil
$service_type = nil
@millenomi
millenomi / SJSchema.h
Created October 22, 2010 09:28
A class for validating a decoded JSON structure without tearing any precious hair.
//
// JSSchema.h
// Subject
//
// Created by ∞ on 22/10/10.
// Copyright 2010 Emanuele Vulcano (Infinite Labs). All rights reserved.
//
#import <Foundation/Foundation.h>
@millenomi
millenomi / gist:756048
Created December 27, 2010 11:09
Need to apply some manipulation to strings in arbitrary apps? Clipboard filtering to the rescue! (OS X 10.6+ only, but can be adapted to other versions and OSes.)
require 'osx/cocoa'
pboard = OSX::NSPasteboard.generalPasteboard
x = nil
loop do
new_x = `pbpaste`
if new_x != x
x = new_x
y = x.gsub(/Art\./, 'art').gsub(/[^a-zA-Z0-9]/, '').downcase
puts y
@millenomi
millenomi / gourl.sh
Created January 14, 2011 16:23
This is a wrapper around the 'curl' command-line tool that adds a few useful features.
#!/bin/bash
if [ "$#" == "0" ]; then
echo "usage: $0 [CURL FLAGS|--json FILE|--https|--dry-run]* URL" >&2
echo "You can set the BASE_URL environment variable; if you do, all relative URLs will be have the BASE_URL appended in front of them. (Note that this appends blindly the two strings together, doing no resolution work.)" >&2
exit 1
fi
args=("$@")
verbatim_args=()
//
// ILService.h
// DependencyInjection
//
// Created by ∞ on 26/02/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import "unzip.h"
@interface ILZIPExtractor : NSObject {
unzFile zip;
}
- (id) initWithZIPAtPath:(NSString*) path;
@property(readonly) NSArray* files;