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
This is basically a dirty hack :) I have no idea if messing with the default OSX apache config this way is frowned upon. My view is that it works now, and if it breaks I'll fix it. | |
Add any domains you want to blacklist to /etc/hosts, pointing at 127.0.0.1. You need to enable web sharing to get apache running of course. | |
Changes to the default /etc/apache2/httpd.conf | |
============================================== | |
Listen 127.0.0.1:80 # so that the world can't see the list | |
DocumentRoot "/Library/WebServer/Documents/public" # to fit in with passenger, you need to create the public dir (and maybe /tmp too) |
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
## | |
# | |
# Automatic | |
# | |
class Developer < ActiveRecord::Base | |
has_many :audit_logs # the macro checks if it can find an obvious inverse_of, but none is found | |
end | |
class AuditLog < ActiveRecord::Base |
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
=== Pure ruby | |
--------------------------------------------- | |
ChunkyPNG (0.10.2) decoding benchmark (n=20) | |
--------------------------------------------- | |
Rehearsal --------------------------------------------------------- | |
PNG - no filtering 2.290000 0.630000 2.920000 ( 1.643999) | |
PNG - UP filtering 4.470000 0.740000 5.210000 ( 2.775279) | |
PNG - PAETH filtering 6.210000 0.680000 6.890000 ( 3.806639) |
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
# The problem: | |
# I wanted to test check_gem, which needs to be called | |
# in the initializer (well, *I* need it to be called in | |
# the initializer) | |
# | |
class Delicious < Base | |
def initialize username, password | |
check_gem | |
# ... |
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
#import <Cocoa/Cocoa.h> | |
#import "opencv2/imgproc/imgproc_c.h" | |
#import "opencv2/highgui/highgui_c.h" | |
#import "opencv2/objdetect/objdetect.hpp" | |
@interface OpenCV : NSObject { | |
int scale; | |
CvCapture* camera; |
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
Payment = Object.new | |
def Payment.new(who_cares); self; end | |
def Payment.fee_amount; self; end | |
def Payment.==(really_who_cares); true; end | |
describe Payment, "#fee_amount" do | |
it "returns 2.9% of $10 + $0.15 ($0.44)" do | |
payment = Payment.new(10.00) | |
payment.fee_amount.should == 0.44 | |
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
// Omitted is a NSDictionary category which adds -[NSDictionary merge:dict] | |
@interface PersonFactory : Factory | |
@end | |
@implementation PersonFactory | |
- (NSDictionary *)validAttrs; | |
{ | |
return @{ @"name":@"Test Person %d", @"email":@"person-%d@example.com" }; |
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
Pod::Spec.new do |s| | |
s.name = 'KIF' | |
s.version = '0.0.1' | |
s.platform = :ios | |
s.license = 'Apache License, Version 2.0' | |
s.summary = 'Keep It Functional - iOS Test Framework' | |
s.homepage = 'https://github.com/square/KIF' | |
s.author = { 'Square' => 'kif-framework@googlegroups.com' } | |
s.source = { :git => 'https://github.com/square/KIF', |
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
class Base64 | |
def self.encode64(string) | |
result = NSData.alloc.initWithData(string).base64EncodedString | |
result = result.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion:true) | |
NSString.alloc.initWithData(result, encoding:NSUTF8StringEncoding) | |
end | |
def self.decode64(string) | |
data = NSData.dataFromBase64String(string) | |
NSString.alloc.initWithData(data, encoding:NSUTF8StringEncoding) |