Skip to content

Instantly share code, notes, and snippets.

@DHowett
DHowett / emoji.m
Last active August 29, 2015 14:04 — forked from siqin/gist:4201667
Strip Emoji (NSString)
#include <unicode/utf8.h>
// This only covers two of the common Emoji ranges, but the Emoji character set is broken
// up across seven different regions.
@implementation NSString (StripEmoji)
- (NSString *)stringByRemovingEmoji {
NSData *d = [self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
if(!d) return nil;
const char *buf = d.bytes;
unsigned int len = [d length];
char *s = (char *)malloc(len);
@DHowett
DHowett / .zshrc
Created February 20, 2011 00:05 — forked from rpetrich/.bash_profile
Shell Bookmarks for ZSH
function _uh { [[ -z $DEV ]]; return $? }
function userroot {
if ! _uh; then echo $DEV;
else echo $HOME; fi
}
function _sdirname {
echo "$(userroot)/.sdirs"
}
#!/bin/sh
SDK=`dirname $0`
SCRIPT=`basename $0`
SDKPARENT=`dirname $SDK`
PLATFORM=`uname -sp`
if [ "$PLATFORM" = "Darwin i386" -o "$PLATFORM" = "Darwin x86_64" ]; then
echo "iPhone Toolchain installer script by rpetrich"
echo ""