Skip to content

Instantly share code, notes, and snippets.

View toto's full-sized avatar

Thomas Kollbach toto

View GitHub Profile
diff --git a/Classes/SMEUser.m b/Classes/SMEUser.m
index c9c89f2..f02d339 100644
--- a/Classes/SMEUser.m
+++ b/Classes/SMEUser.m
@@ -569,10 +569,10 @@
- (NSURL *)editingController:(TKModelEditingController *)controller confirmationContentURLForKey:(NSString *)key;
{
if ([key isEqual:@"hasAcceptedPrivacyStatement"]) {
- return [NSURL URLWithString:@"https://www.samedi.de/de/terms_of_service/patient?layout=iphone"];
+ return [NSURL URLWithString:@"https://www.samedi.de/de/privacy_statement/patient?layout=iphone"];
@toto
toto / gist:1892885
Created February 23, 2012 13:44
Pass redirect URLs from an embedded webView to the shared account store
- (void)awakeFromNib;
{
[super awakeFromNib];
_webView.policyDelegate = self; // you can also do this in the XIB and save you this method
}
- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id < WebPolicyDecisionListener >)listener;
{
NSURL *redirectURL = [NSURL URLWithString:VCOAuthRedirectURLString];
if ([request.URL.scheme isEqual:redirectURL.scheme] &&
@toto
toto / gist:1768284
Created February 8, 2012 11:24
A simple webserver that makes the current directory available via HTTP
#!/usr/bin/env ruby
require "webrick"
port = ARGV.count > 0 ? ARGV.last.to_i : 8080
STDERR.puts "Starting WEBRick server on http://localhost:#{port}"
server = WEBrick::HTTPServer.new :Port => port
server.mount "/", WEBrick::HTTPServlet::FileHandler, './'
trap('INT') do
STDERR.puts "Stopping WEBRick"
server.stop
end
# -reexport_framework and -umbrella for 10.4
mkdir -p Bar.framework Foo.framework
${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -umbrella Foo -mmacosx-version-min=10.5
${FAIL_IF_BAD_MACHO} Bar.framework/Bar
${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -Wl,-reexport_framework,Bar -mmacosx-version-min=10.5
${FAIL_IF_BAD_MACHO} Foo.framework/Foo
otool -lv Bar.framework/Bar | grep LC_SUB_FRAMEWORK | ${FAIL_IF_EMPTY}
otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY}
${PASS_IFF} /usr/bin/true
@toto
toto / uselessComments.java
Created April 22, 2011 15:22
If you force people to write doc-comments this is what happens
/**
* 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) {
// …
}
@toto
toto / google_user_location.rb
Created April 22, 2011 13:14
Gets your location using the google wifi location service (also used by Firefox) using the Mac OS X CoreWLAN framework on Snow Leopard. Also compare to the CoreLocation based version https://gist.github.com/266916
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
@toto
toto / org.xsane.saned.plist
Created January 16, 2011 15:01
launchd config fille to use a homebrew installed saned with the inetd compatibility features in launchd.
<?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>
@toto
toto / gist:741242
Created December 14, 2010 22:33
AirPlay Connection Upgrading
POST /reverse HTTP/1.1
Upgrade: PTTH/1.0
Connection: Upgrade
Content-Length: 0
User-Agent: MediaControl/1.0
require 'rubygems'
require 'pp'
require 'json'
require 'httparty'
url = "http://www.adgonline.de/adg_online/phoenix/searchalyzr.jspx"
class Loader
include HTTParty
end
#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) {