Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

ttscoff / searchlink.rb
Last active February 26, 2024 07:05
SearchLink creates Markdown links from automatic searches based on special syntax.
Shchvova /
Created August 27, 2012 13:42
Match 3 game for Pythonista app. Yes, typed all on iPad. Copy/Paste it to app
from scene import *
from random import choice, randrange
import sound
TILE_SIZE=64 #size of tile
SDX=4 #selection frame size
M=3 #match 3(?) game
NOS = (-1, -1) #constant to indicate clear selection
FALL_S=0.2 #speed of fall per each tile
FALL_T=0 #constant fall tile
gillibrand /
Created August 6, 2012 05:38
An Air Hockey game for Pythonista on iPad and iPhone. Yes, I typed this all on my iPad. A little painful.
# Hockey
# A air hockey game for two players. First to
# seven wins.
# Most of the game is drawn with the scene
# module. Goal and winner messages are animated
# with layers.
from scene import *
from sound import *
brentsimmons / EmptyChecks.m
Created July 28, 2012 19:06
Checking if an object is empty
BOOL RSIsEmpty(id obj) {
return obj == nil || obj == [NSNull null] || ([obj respondsToSelector:@selector(length)] && [(NSData *)obj length] == 0) || ([obj respondsToSelector:@selector(count)] && [obj count] == 0);
BOOL RSStringIsEmpty(NSString *s) {
/*22 Feb. 2011: added NSNull check. JSON parser can put a null where we expect a string, and NSNull throws an exception when checking length. Since [NSNull null] is, arguably, emptiness, it makes sense to include it.*/
return s == nil || (id)s == (id)[NSNull null] || [s length] == 0;
tibr / NSFileManager+DoNotBackup.h
Created March 8, 2012 09:42
Setting the do not backup attribute in different iOS versions
@interface NSFileManager (DoNotBackup)
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
Bokugene / CGFontToFontData.m
Created February 23, 2012 13:21
Read Table Data from a CGFont, then wrap them into a OTF/TTF font.
typedef struct FontHeader {
int32_t fVersion;
uint16_t fNumTables;
uint16_t fSearchRange;
uint16_t fEntrySelector;
uint16_t fRangeShift;
typedef struct TableEntry {
uint32_t fTag;