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
DEFAULT_OPTIONS.keys.each do |key| | |
define_method key do | |
return options[key.to_sym] unless options.nil? | |
end | |
define_method "#{key}=".to_sym do |value| | |
returning(options || {}) do |opt| | |
options[key.to_sym] = value | |
end | |
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
<?xml version="1.0"?> | |
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | |
<service_bundle type="manifest" name="sphinx"> | |
<service name="network/sphinx" type="service" version="0"> | |
<dependency name="fs" grouping="require_all" restart_on="none" type="service"> | |
<service_fmri value="svc:/system/filesystem/local"/> | |
</dependency> | |
<dependency name="net" grouping="require_all" restart_on="none" type="service"> | |
<service_fmri value="svc:/network/loopback"/> | |
</dependency> |
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
/* | |
Some sample code for a horizontal paged UIScrollView with a gap between each image (which looks nicer). Note - not using contentInset, we want each page to fill the iPhone screen and the gap only to be visible when scrolling (like Photos.app). | |
Taking the iPhone status bar into account - our viewport is 320x460 | |
Our UIScrollView is therefore set in Interface Builder to 340x460 with a -10 X offset (so it's larger than the viewport but still centred) | |
Then we do the following... | |
*/ | |
// Our image filenames |
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
require 'yaml' | |
require 'xmlrpc/client' | |
typo = XMLRPC::Client.new('blog.host.name', '/backend/xmlrpc') | |
posts = typo.call('metaWeblog.getRecentPosts', '1', 'username', 'password', 1_000_000).select{|p| !p['description'].nil?}.collect do |post| | |
{'title' => post['title'], | |
'body' => post['description'], | |
'body_converter' => post['mt_convert_breaks'], | |
'tags' => post['mt_keywords'], |
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 <Foundation/Foundation.h> | |
int main (int argc, const char * argv[]) { | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSArray *tests = [NSArray arrayWithObjects: [NSMutableDictionary dictionary], [NSDictionary dictionary], nil]; | |
SEL sel = @selector(setObject:forKey:); | |
for(id obj in tests) { |
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
require 'rubygems' | |
require 'pp' | |
require 'json' | |
require 'httparty' | |
url = "http://www.adgonline.de/adg_online/phoenix/searchalyzr.jspx" | |
class Loader | |
include HTTParty | |
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
POST /reverse HTTP/1.1 | |
Upgrade: PTTH/1.0 | |
Connection: Upgrade | |
Content-Length: 0 | |
User-Agent: MediaControl/1.0 | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.xsane.saned</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/sbin/saned</string> | |
</array> |
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
require 'pp' | |
require 'net/http' | |
require 'net/https' | |
require 'rubygems' | |
require 'json' | |
def bssid_to_api(bssidstr) | |
bssidstr.gsub(':', '-').gsub(/(\-|\A)(\d)(\-|\Z)/) {|match| "#{match[0]}0#{match[1]}#{match[2]}"} | |
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
/** | |
* Berechnet zu einem gegebenen Pfad dessen Fitnesswert | |
* | |
* @param subPfad | |
* der Pfad, dessen Fitnesswert bestimmt werden soll | |
* @return Fitnesswert des Pfades | |
*/ | |
private ArrayList<scoredPath> getPfadFitness(ArrayList<scoredPath> pathesToScore, Boolean hasUwkt) { | |
// … | |
} |