Skip to content

Instantly share code, notes, and snippets.

(function(j,l){var g=typeof"",i=typeof undefined,c=typeof function(){},d=typeof{},h=function(o,n){return typeof o===n},a=function(n){return h(n,g)},e=function(n){return h(n,i)},b=function(n){return h(n,c)},m=function(n){return h(n,d)},k=function(n){return typeof HTMLElement==="object"?n instanceof HTMLElement:typeof n==="object"&&n.nodeType===1&&typeof n.nodeName==="string"},f=function(H){var E={MooTools:"$$",Prototype:"$$",jQuery:"*"},w=0,s="SCI-",x={},t=H||"simpleCart",J={},C={},u={},F=j.localStorage,B=j.console||{msgs:[],log:function(L){B.msgs.push(L)}},z="value",I="text",K="html",y="click",D={USD:{code:"USD",symbol:"$",name:"US Dollar"},AUD:{code:"AUD",symbol:"$",name:"Australian Dollar"},BRL:{code:"BRL",symbol:"R$",name:"Brazilian Real"},CAD:{code:"CAD",symbol:"$",name:"Canadian Dollar"},CZK:{code:"CZK",symbol:" Kč",name:"Czech Koruna",after:true},DKK:{code:"DKK",symbol:"DKK ",name:"Danish Krone"},EUR:{code:"EUR",symbol:"€",name:"Euro"},HKD:{code:"HKD",symbol:"&#36
@pablasso
pablasso / gist:4163042
Created November 28, 2012 18:22
Callback
io.sockets.on('connection', function(socket){
console.log('client just connected');
socket.emit('joined', {message:'client just connected'});
socket.on('getCities', function(data, callback){
console.log('getCities');
callback([{name:'city 1'}, {name:'city 2'}]);
});
});
@pablasso
pablasso / gist:4163043
Created November 28, 2012 18:22
Callback
io.sockets.on('connection', function(socket){
console.log('client just connected');
socket.emit('joined', {message:'client just connected'});
socket.on('getCities', function(data, callback){
console.log('getCities');
callback([{name:'city 1'}, {name:'city 2'}]);
});
});
@pablasso
pablasso / gist:4229823
Created December 7, 2012 00:55
HMAC SHA1 with Base64
// Uses this library for Base64 https://github.com/ekscrypto/Base64
+ (NSString *)hmacSHA1WithKey:(NSString *)key andSecret:(NSString *)secret {
NSData *secretData = [secret dataUsingEncoding:NSUTF8StringEncoding];
NSData *clearTextData = [key dataUsingEncoding:NSUTF8StringEncoding];
unsigned char result[20];
CCHmac(kCCHmacAlgSHA1, [secretData bytes], [secretData length], [clearTextData bytes], [clearTextData length], result);
return [[NSData dataWithBytes:result length:20] base64String];
}
@pablasso
pablasso / gist:4235489
Created December 7, 2012 18:53
Escape URL entities
+ (NSString *)stringByAddingPercentEscapes:(NSString *)string {
NSString *charactersToLeaveUnescaped = @"";
NSString *legalCharactersToEscape = @"&+%=";
return CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)string, (CFStringRef)charactersToLeaveUnescaped, (CFStringRef)legalCharactersToEscape,CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)));
}
@pablasso
pablasso / WhirlyGlobe.podspec
Created January 30, 2013 18:49
Pod spec for WhirlyGlobe by @jcollas
Pod::Spec.new do |s|
s.name = "WhirlyGlobe"
s.version = "2.1"
s.summary = "WhirlyGlobe is a self contained 3D earth display view suitable for use in iPhone and iPad applications."
s.homepage = "https://github.com/mousebird/WhirlyGlobe"
s.license = { :type => "Apache 2.0" }
s.author = { "Steve Gifford" => "[email protected]" }
s.source = { :git => "https://github.com/jcollas/WhirlyGlobe.git", :branch => "develop" }
s.platform = :ios
@pablasso
pablasso / gist:5008481
Created February 21, 2013 21:37
Check for hits on a view and ignore them yourself, passing them to your subviews.
- (id)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
id hitView = [super hitTest:point withEvent:event];
if (hitView == self) {
return nil;
}
return hitView;
}
Pod::Spec.new do |s|
s.name = "KSReachability"
s.ios.deployment_target = "4.0"
s.osx.deployment_target = "10.6"
s.version = "1.1"
s.summary = "A better iOS & Mac reachability for a modern age."
s.homepage = "https://github.com/kstenerud/KSReachability"
s.license = { :type => 'MIT', :file => 'README.md' }
s.author = { "Karl Stenerud" => "[email protected]" }
s.source = { :git => "https://github.com/kstenerud/KSReachability.git", :tag => "1.1" }
@pablasso
pablasso / gist:5398434
Last active December 16, 2015 07:28
Reachability from master
license = <<-EOF
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
@pablasso
pablasso / gist:5503538
Created May 2, 2013 16:45
wget thingies
-E --adjust-extension’
If a file of type ‘application/xhtml+xml’ or ‘text/html’ is downloaded and the URL does not end with the regexp ‘\.[Hh][Tt][Mm][Ll]?’, this option will cause the suffix ‘.html’ to be appended to the local filename. This is useful, for instance, when you're mirroring a remote site that uses ‘.asp’ pages, but you want the mirrored pages to be viewable on your stock Apache server. Another good use for this is when you're downloading CGI-generated materials. A URL like ‘http://site.com/article.cgi?25’ will be saved as article.cgi?25.html.
Note that filenames changed in this way will be re-downloaded every time you re-mirror a site, because Wget can't tell that the local X.html file corresponds to remote URL ‘X’ (since it doesn't yet know that the URL produces output of type ‘text/html’ or ‘application/xhtml+xml’.
As of version 1.12, Wget will also ensure that any downloaded files of type ‘text/css’ end in the suffix ‘.css’, and the option was renamed from ‘--html-extension’, to better refle