This file contains 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'osx/cocoa' | |
app = OSX::NSApplication.sharedApplication | |
window = OSX::NSWindow.alloc.initWithContentRect_styleMask_backing_defer( | |
[0,0,500,500], | |
OSX::NSTitledWindowMask + OSX::NSClosableWindowMask, |
This file contains 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
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// andy@andymatuschak.org | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.h> |
This file contains 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
delegate = Object.new | |
def delegate.netServiceBrowserWillSearch(browser) | |
puts "search commencing!" | |
end | |
def delegate.netServiceBrowser(browser, didFindService:service, moreComing:more) | |
# this never calls regardless of the services on the network. | |
puts "Found service #{service.name}." | |
end |
This file contains 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
// | |
// NSObject+ProcObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// andy@andymatuschak.org | |
// Public domain because I love you. Let me know how you use it. | |
// | |
// NTW 2009-Oct-21: Added selectors with an options argument. | |
// NTW 2009-Oct-30: Transplanted new observation key from MYUtilities's KVUtils. |
This file contains 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 -*- | |
# AO render benchmark (GCD version for MacRuby 0.6) | |
# Original program (C) Syoyo Fujita in Javascript (and other languages) | |
# http://lucille.atso-net.jp/blog/?p=642 | |
# http://lucille.atso-net.jp/blog/?p=711 | |
# Ruby(yarv2llvm) version by Hideki Miura | |
# http://github.com/miura1729/yarv2llvm/blob/a888d8ce6855e70b630a8673d4cfe075a8e44f0e/sample/ao-render.rb | |
# Modified by Tomoyuki Chikanaga | |
# |
This file contains 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
A backup of http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case | |
Why is this necessary? Read http://sites.google.com/site/redcodenl/patent-infringement | |
Please fork, tweet about, etc. | |
---- | |
Creating Shazam in Java | |
A couple of days ago I encountered this article: How Shazam Works | |
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java? |
This file contains 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
/* | |
* Copyright (C) 2008 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains 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 Kermit | |
class Request | |
def initialize(url, success, failure=nil) | |
@request = NSURLRequest.requestWithURL(NSURL.URLWithString(url)) | |
@success = success | |
@failure = failure | |
# @parser = Yajl::Parser.new(:symbolize_keys => true) | |
end | |
def connection |
This file contains 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
// | |
// MASWindow.h | |
// A Mac App Store-like NSWindow subclass. | |
// | |
// Created by Zachary Waldowski on 1/8/11. | |
// Secured under the "do-whatever-the-hell-you-want-with-it" license. Erm, copyright 2011. | |
// | |
#import <Cocoa/Cocoa.h> |
This file contains 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
// Reads in a set of raw data files, and outputs smoothed files. (lots of libdispatch magic) | |
#define SIGMA (50) | |
#define CONST_A (1 / sqrt(2 * pi * (pow(SIGMA, 2)))) | |
- (IBAction)smoothDataSets:(id)sender { | |
[openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger ret){ | |
if(ret == NSOKButton){ | |
// Generate a gaussian weight | |
int len = 6 * SIGMA + 1; | |
double weight[len]; | |
for(int i = 0; i < len; i++){ |
OlderNewer