Skip to content

Instantly share code, notes, and snippets.

View tmdvs's full-sized avatar
:shipit:
making things and breaking things

Tim Davies tmdvs

:shipit:
making things and breaking things
View GitHub Profile
/**
* Live updating API JS client side class
* @author Tim Davies
*/
function liveupdatingClient (container)
{
/**
* Set up, include handlebars and setup template
*/
var endpoint = 'liveupdating.php';
[[self layer] setMasksToBounds:YES];
[[self layer] setShadowColor:[[UIColor blackColor] CGColor]];
[[self layer] setShadowOffset:CGSizeMake(0, 0)];
[[self layer] setShadowOpacity:1];
[[self layer] setShadowRadius:4.0];
[[self layer] setBackgroundColor:[[UIColor clearColor] CGColor]];
@tmdvs
tmdvs / gist:3603700
Created September 2, 2012 19:34
Help my broken brains
The following doesnt work for some reason and it's really hurting my brains.
The variables contents are:
===========================
myString = <script src="/mint/?js" type="text/javascript">
matchedString = ?js"
I'm finding the range:
======================
NSRange matchRange = [[myString string] rangeOfString:matchedString options:NSLiteralSearch];
alias ls='ls -gFh'
# MacPorts Installer addition on 2010-10-11_at_11:46:41: adding an appropriate $
export PATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
export GREP_OPTIONS='--color=auto'
export CLICOLOR=1;
function git-branch() {

This is a gist.io test

This is a subheading

This is some simple body text that I am writing. why not click here

// Get the data into a bitmap.
[self lockFocus];
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[self bounds]];
[self unlockFocus];
// Make an NSImage from our bitmap.
image = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
[image addRepresentation:rep];
NSData * tiffData = [image TIFFRepresentationUsingCompression: NSTIFFCompressionNone factor: 0.0f];
What Apple gives you and will cause a crash as dequeueReusableCellWithIdentifier: can't return a cell as none have ever been initialised.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
return cell;
}
@implementation StubbyNavigationController
- (UINavigationBar *)navigationBar
{
[super.navigationBar setFrame:CGRectMake(0, 20, 300, 44)];
return super.navigationBar;
}
@end
#import "NSDataAdditions.h"
static char encodingTable[64] = {
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' };
@implementation NSData (NSDataAdditions)
+ (NSData *) dataWithBase64EncodedString:(NSString *) string {