This file contains hidden or 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
module MLS | |
extend self | |
GRID = ("A".."R").to_a | |
SQUARE = ("0".."9").to_a | |
SUB = ("a".."x").to_a | |
deg = 180.0 | |
PARTS = [[18, GRID], [10, SQUARE], [24, SUB], [10, SQUARE]] | |
PARTS.map! { |div, part| [deg = deg / div, part] } |
This file contains hidden or 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
require 'bundler/setup' | |
require 'mechanize' | |
class Device | |
attr_accessor :name, :uuid, :id | |
end | |
class ProvisioningPortal | |
attr_reader :connection | |
This file contains hidden or 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
// SVGCanvas.prototype.transform = SVGCanvas.prototype.translate; | |
// SVGCanvas.prototype.fillText = SVGCanvas.prototype.text; | |
paper.View.prototype.toSVG = function() { | |
var svgContext = new SVGCanvas(this.canvas.width, this.canvas.height); | |
var oldCtx = this._context; | |
this._context = svgContext; | |
this.draw(false); |
This file contains hidden or 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
// Extend Backbone.Model to support setting a namespace | |
// for models. Example response from server: | |
// { | |
// 'modelname' : { | |
// ... attributes ... | |
// } | |
// We dont want the attributes to be scoped by the model name | |
// in the models attributes property. This new parse function | |
// will drop the namespace if it is defined on the model. | |
// Example: |
This file contains hidden or 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
# encoding: UTF-8 | |
require 'open-uri' | |
require 'uri' | |
def finn(id) | |
doc = open("http://www.finn.no/finn/realestate/homes/object?finnkode=#{id}").read | |
doc =~ /helios_parameters\s?:\s?'(.*)'/ | |
attrs = $1.split(';').inject({}) do |mem, e| | |
key, value = e.split "=" |
This file contains hidden or 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
function loadAd(url, div) { | |
function makeAdParser(el, cb) { | |
var inNoScriptTag = false; | |
var parser = function(txt) { | |
txt = txt.trim(); | |
if(txt === '</noscript>') { inNoScriptTag = false; return; } | |
if(txt === '<noscript>') { inNoScriptTag = true; return; } | |
if(inNoScriptTag) { return; } |
This file contains hidden or 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
#import <Cocoa/Cocoa.h> | |
@interface RBAppDelegate : NSObject <NSApplicationDelegate> | |
{ | |
NSStatusItem *systemStatusItem; | |
} | |
@end |
This file contains hidden or 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
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSStatusBar *bar = [NSStatusBar systemStatusBar]; | |
systemStatusItem = [bar statusItemWithLength:NSVariableStatusItemLength]; | |
[systemStatusItem setTitle:@"Radio"]; | |
[systemStatusItem setMenu:NULL]; | |
[systemStatusItem retain]; | |
} |
This file contains hidden or 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
- (void) quit { | |
[NSApp terminate:NULL]; | |
} |
This file contains hidden or 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
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSStatusBar *bar = [NSStatusBar systemStatusBar]; | |
systemStatusItem = [bar statusItemWithLength:NSVariableStatusItemLength]; | |
[systemStatusItem setTitle:@"Radio"]; | |
[systemStatusItem retain]; | |
NSMenu *appMenu = [[NSMenu alloc] init]; | |
[appMenu addItemWithTitle:@"Avslutt" action:@selector(quit) keyEquivalent:@""]; | |
[systemStatusItem setMenu:appMenu]; |