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
- (BOOL)stringContainsEmoji:(NSString *)string | |
{ | |
__block BOOL returnValue = NO; | |
[string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock: | |
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { | |
const unichar hs = [substring characterAtIndex:0]; | |
// surrogate pair | |
if (0xd800 <= hs && hs <= 0xdbff) { | |
if (substring.length > 1) { |
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
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
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
// | |
// KBNetworkActivityIndicator.h | |
// Kobov3 | |
// | |
// Created by Jim Dovey on 10-03-21. | |
// Copyright 2010 Kobo Inc. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
# install node wherever... | |
cat <<NPMRC >>$HOME/.npmrc | |
root = ~/.node_libraries | |
manroot = ~/local/share/man | |
binroot = ~/bin | |
NPMRC | |
curl http://npmjs.org/install.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
# | |
# uncrustify config file for objective-c and objective-c++ | |
# | |
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs | |
output_tab_size = 4 # new tab size | |
indent_columns = output_tab_size | |
indent_label = 2 # pos: absolute col, neg: relative column | |
indent_align_assign = FALSE |
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
@interface UIImage (Shadow) | |
+ (UIImage *)imageWithContentsOfFile:(NSString *)path withShadow:(BOOL)applyShadow; | |
+ (UIImage *)imageNamed:(NSString *)name withShadow:(BOOL)applyShadow; | |
+ (UIImage *)applyShadow:(UIImage *)theImage; | |
@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
// ========================= | |
// SetInterval | |
// ========================= | |
// While not truly accurate, setInterval is still fairly good, time-wise. | |
// Better for things like a "one second tick" but not great for expensive | |
// code executed at small intervals as iterations can "stack". | |
// (ECMAScript 5 strict mode compatible) |
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
/* | |
* CLAlert is a drop-in replacement for NSAlert | |
* | |
* A CLAlert is exactly the same as a NSAlert, except for the alert style behavior | |
* | |
* - An alert with the informational style (NSInformationalAlertStyle) will always display a "Note icon" (kAlertNoteIcon) | |
* - An alert with the warning style (NSWarningAlertStyle) will always display a "Caution icon" (kAlertCautionIcon) | |
* - An alert with the critical style (NSCriticalAlertStyle) will always display a "Stop icon" (kAlertStopIcon) | |
* | |
* Tested on Mac OS X 10.5.8 and 10.6.1 |