I hereby claim:
- I am zachwaugh on github.
- I am zachwaugh (https://keybase.io/zachwaugh) on keybase.
- I have a public key whose fingerprint is 6B46 CDCF BBD4 4006 97C2 0D7A 70CA 12E6 82A9 D4C6
To claim this, I am signing this object:
/*! | |
* Fade Out element and remove from DOM | |
*/ | |
(function($) | |
{ | |
$.fn.fadeOutAndRemove = function(duration) | |
{ | |
duration = (duration === undefined) ? 250 : duration; | |
return this.fadeOut(duration, function() |
#!/usr/bin/env ruby | |
# Load Rails | |
ENV['RAILS_ENV'] = ARGV[0] || 'production' | |
DIR = File.dirname(__FILE__) | |
require DIR + '/../config/environment' | |
# ... do stuff that requires using your rails models |
tell application "System Events" | |
set x to application bindings of spaces preferences of expose preferences | |
set x to {|com.twitter.twitter-mac|:3} & x -- 3 is any space you don't want twitter on | |
set application bindings of spaces preferences of expose preferences to x | |
set x to {|com.twitter.twitter-mac|:4} & x -- 4 is the space you want twitter to be on | |
set application bindings of spaces preferences of expose preferences to x | |
end tell |
console.log('100', 'something'); | |
console.log(100, 'something'); | |
console.log(100, 'something', 'something else'); | |
console.log(100 + ' something'); | |
console.log('something', 100, 'something'); |
- (UIImage *)imageWithMask:(UIImage *)maskImage andIsWhite:(BOOL)isWhite | |
{ | |
CGRect imageRect = CGRectMake(0, 0, maskImage.size.width, maskImage.size.height); | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
CGContextRef ctx = CGBitmapContextCreate(NULL, maskImage.size.width, maskImage.size.height, 8, 0, colorSpace, kCGImageAlphaPremultipliedLast); | |
CGContextClipToMask(ctx, imageRect, maskImage.CGImage); | |
if (isWhite) { | |
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1); | |
} else { |
// [image writeToFile:[NSURL fileURLWithPath:@"/some/path/image.png"]]; | |
- (void)writeToFile:(NSURL *)fileURL | |
{ | |
NSBitmapImageRep *bitmapRep = nil; | |
for (NSImageRep *imageRep in [self representations]) | |
{ | |
if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) | |
{ | |
bitmapRep = (NSBitmapImageRep *)imageRep; |
// static var to store shared date formatter | |
static NSDateFormatter *_formatter = nil; | |
@implementation NSDate (Extras) | |
// Simple comparison, create a string from today and date, see if they're the same | |
- (BOOL)isToday | |
{ | |
// Lazy load and cache formatter, date formatters are slow to init | |
if (!_formatter) |
I hereby claim:
To claim this, I am signing this object:
#import <Foundation/Foundation.h> | |
// Experimental improvement to NSDictionaryOfVariableBindings where keys are simplified to remove underscores and "self." prefixes | |
// so you can use the simple version within the VFL string | |
// | |
// Example: | |
// | |
// [NSLayoutConstraint constraintsWithVisualFormat:@"|-[_foo]-[self.bar]-[baz]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_foo, self.bar, baz)]; | |
// -> this doesn't work, gives an error about "self." | |
// |