⌥ + ⌘ + ]
Align Assignments
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
// https://twitter.com/dwineman/status/601853359839006721 | |
// Default arguments are expressions, not constants, evaluated only when necessary. | |
extension UIImage { | |
static func emptyImage(size: CGSize, scale: CGFloat = UIScreen.mainScreen().scale) -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(size, false, scale) | |
let image = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
return image | |
} |
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
public class var sharedConfiguration: AppConfiguration { | |
struct Singleton { | |
static let sharedAppConfiguration = AppConfiguration() | |
} | |
return Singleton.sharedAppConfiguration | |
} | |
// Checkout Lister: A Productivity App Built in Swift by Apple |
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> | |
typedef void (^RCTaskBlock)(NSString *keyPath, id object, NSDictionary *change); | |
@interface TZReceptionist : NSObject | |
+ (id)receptionistForKeyPath:(NSString *)path | |
object:(id)obj | |
queue:(NSOperationQueue *)queue | |
task:(RCTaskBlock)task; | |
@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
#!/usr/bin/env ruby | |
unless ARGV[0] | |
puts 'Usage: newpost "the post title"' | |
exit(-1) | |
end | |
date_prefix = Time.now.strftime("%Y-%m-%d") | |
postname = ARGV[0].strip.downcase.gsub(/ /, '-') | |
post = "./_posts/#{date_prefix}-#{postname}.md" |
-
⌃ + a
Move to the beginning of the line. -
⌃ + e
Move to the end of the line. -
⌃ + u
Clear the entire line. -
⌃ + w
Delete the word in front of the cursor. -
⌃ + r
Search history.
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
#!/usr/bin/env node | |
var checkprime = function(smallerPrimes, number) { | |
isprime = 1; | |
for (var i = 0; i < smallerPrimes.length; i++) { | |
if (number % smallerPrimes[i] == 0) { | |
isprime = 0; | |
break; | |
} | |
} |
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 <mach/mach.h> | |
#import <mach/mach_host.h> | |
void print_free_memory () | |
{ | |
mach_port_t host_port; | |
mach_msg_type_number_t host_size; | |
vm_size_t pagesize; | |
host_port = mach_host_self(); |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:" | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/" | |
//via http://deallocatedobjects.com/posts/show-todos-and-fixmes-as-warnings-in-xcode-4 |
NewerOlder