Skip to content

Instantly share code, notes, and snippets.

Darcy Liu darcyliu

Block or report user

Report or block darcyliu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rcabaco
rcabaco / gist:6765778
Created Sep 30, 2013
UITextView subclass to handle up/down cursor movement
View gist:6765778
// Code to handle up/down cursor motion in a UITextView.
//
// Based on code from OmniGroup's OUITextView
// https://github.com/omnigroup/OmniGroup/blob/master/Frameworks/OmniUI/iPad/OUITextView.m
//
#import "TextView.h"
@interface TextView ()
@ryanjbonnell
ryanjbonnell / gist:3880048
Last active Apr 19, 2018
Install Memcache on Mac OS X 10.8 "Mountain Lion"
View gist:3880048
# memcached requires libevent
cd /usr/local/src
curl -L -O http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
tar -xvzf libevent-2.0.17-stable.tar.gz
cd libevent-2.0.17-stable*
./configure
make
sudo make install
# Compile memcached utility
@snikch
snikch / gist:3661188
Created Sep 6, 2012
Find the current top view controller for your iOS application
View gist:3661188
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@fermion
fermion / apns.py
Created Mar 2, 2012 — forked from scotttam/apns.py
Sends an Apple Push Notification with Python
View apns.py
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
@dvessel
dvessel / gist:1478685
Created Dec 14, 2011
TextMate 2 .tm_properties
View gist:1478685

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@jtowle
jtowle / gist:1174024
Created Aug 26, 2011
Newsstand App Delegate's applicationDidFinishLaunchingWithOptions
View gist:1174024
/***********************************************
* In application:DidFinishLaunchingWithOptions:
************************************************/
// Set up newsstand helper
// newsstand is an ivar - you will need to declare it in your header and
// release it in dealloc
newsstand = [[UANewsstandHelper alloc] init];
@christian-oudard
christian-oudard / gfm.py
Created Jun 29, 2010
Github Flavored Markdown in Python
View gfm.py
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5(matchobj.group(0)).hexdigest()
extractions[digest] = matchobj.group(0)
return "{gfm-extraction-%s}" % digest
You can’t perform that action at this time.