Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU
Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys
Consumer key: CjulERsDeqhhjSme66ECg
| // Usage: ng-draggable="dragFile($event)" | |
| App.directive('ngDraggable', function ($parse) { | |
| return { | |
| restrict: 'A', | |
| link: function (scope, elem, attrs) { | |
| var fn = $parse(attrs.ngDraggable); | |
| elem[0].draggable = true; | |
| elem.bind('dragstart', function (event) { | |
| scope.$apply(function () { |
Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU
Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys
Consumer key: CjulERsDeqhhjSme66ECg
| func ValueAtKeyPath(path string, v interface{}) interface{} { | |
| // Parse the path syntax | |
| p := make([]interface{}, 0, len(path)) | |
| rx := regexp.MustCompile(`([a-zA-Z0-9_\-]+)|(\[(\d+)\])`) | |
| for _, m := range rx.FindAllStringSubmatch(path, -1) { | |
| if strings.HasPrefix(m[0], "[") { | |
| i, err := strconv.Atoi(m[len(m)-1]) | |
| if err != nil { | |
| panic(err) | |
| } |
| package main | |
| import ( | |
| "database/sql" | |
| _ "github.com/bmizerany/pq" | |
| "log" | |
| ) | |
| func main() { | |
| query(true) |
| #import <arpa/inet.h> | |
| #import <ifaddrs.h> | |
| #import <net/if.h> | |
| BOOL localWiFiAvailable( void ) | |
| { | |
| struct ifaddrs *addresses; | |
| struct ifaddrs *cursor; | |
| BOOL wiFiAvailable = NO; |
| @implementation NSImage (Stretchable) | |
| - (void)drawStretchableInRect:(NSRect)rect edgeInsets:(NSEdgeInsets)insets operation:(NSCompositingOperation)op fraction:(CGFloat)delta { | |
| void (^makeAreas)(NSRect, NSRect *, NSRect *, NSRect *, NSRect *, NSRect *, NSRect *, NSRect *, NSRect *, NSRect *) = ^(NSRect srcRect, NSRect *tl, NSRect *tc, NSRect *tr, NSRect *ml, NSRect *mc, NSRect *mr, NSRect *bl, NSRect *bc, NSRect *br) { | |
| CGFloat w = NSWidth(srcRect); | |
| CGFloat h = NSHeight(srcRect); | |
| CGFloat cw = w - insets.left - insets.right; | |
| CGFloat ch = h - insets.top - insets.bottom; | |
| CGFloat x0 = NSMinX(srcRect); |
| @implementation NSURLConnection (Timeout) | |
| + (dispatch_queue_t)timeoutLockQueue { | |
| static dispatch_queue_t queue; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| queue = dispatch_queue_create("timeout lock queue", DISPATCH_QUEUE_SERIAL); | |
| }); | |
| return queue; | |
| } |
| @implementation NSImage (Resizable) | |
| - (void)drawStretchableInRect:(NSRect)rect edgeInsets:(NSEdgeInsets)insets operation:(NSCompositingOperation)op fraction:(CGFloat)delta { | |
| NSRect srcRect = (NSRect){NSZeroPoint, self.size}; | |
| NSRect topLeft = NSMakeRect(NSMinX(srcRect), NSMaxY(srcRect) - insets.top, insets.left, insets.top); | |
| NSRect centerLeft = NSMakeRect(NSMinX(srcRect), NSMinY(srcRect) + insets.bottom, insets.left, NSHeight(srcRect) - insets.top - insets.bottom); | |
| NSRect bottomLeft = NSMakeRect(NSMinX(srcRect), NSMinY(srcRect), insets.left, insets.bottom); | |
| NSRect topCenter = NSMakeRect(NSMaxX(topLeft), |
| // Assuming ARC is enabled. | |
| // |button| is of type UIButton (works with NSButton as well). | |
| [button addTarget:[^{ NSLog(@"Block invoked."); } copy] | |
| action:@selector(invoke) | |
| forControlEvents:UIControlEventTouchUpInside]; |