Skip to content

Instantly share code, notes, and snippets.

View robinhayward's full-sized avatar

Robin Hayward robinhayward

View GitHub Profile
@robinhayward
robinhayward / gist:3313605
Created August 10, 2012 11:28
Stream sample
[
{
"text":"Some free flowing text about this stream item to be displayed as plain paragraph",
"icon":"http://www.icon.com/thing.png",
"timestamp":2345678998,
"stats": [
{ "name":"A bold stat name 1","value":"15(1)" },
{ "name":"A bold stat name 2","value":"12(1)" }
]
}
{
"response": [
{ "name":"Super King Innings","batting":[{"batter":"Lasith Maling","out":"run out (Ambati Raydud)","R":3,"B":2,"SR":150,"4":0,"6":0},{"batter":"Lasith Maling","out":"run out (Ambati Raydud)","R":3,"B":2,"SR":150,"4":0,"6":0}],"bowling":[{"bowler":"Lasith Maling","o":3.5,"r":16,"w":2,"e":0},{"bowler":"Lasith Maling","o":3.5,"r":16,"w":2,"e":0}],"totalover":19.5,"totalrun":112,"fall":"1-4 (Francois du plessis, 1.4 ov)" },
{ "name":"Super King Innings","batting":[{"batter":"Lasith Maling","out":"run out (Ambati Raydud)","R":3,"B":2,"SR":150,"4":0,"6":0},{"batter":"Lasith Maling","out":"run out (Ambati Raydud)","R":3,"B":2,"SR":150,"4":0,"6":0}],"bowling":[{"bowler":"Lasith Maling","o":3.5,"r":16,"w":2,"e":0},{"bowler":"Lasith Maling","o":3.5,"r":16,"w":2,"e":0}],"totalover":19.5,"totalrun":112,"fall":"1-4 (Francois du plessis, 1.4 ov)" }
]
}
{
"response": {
"score":[
{"team":"Super Kings","totalover":19.5,"totalrun":112,"teamimage":"http:\/\/cdn.moshen.com\/images\/team1.jpeg","turn":"batting"},
{"team":"Indians","totalover":19.5,"totalrun":112,"teamimage":"http:\/\/cdn.moshen.com\/images\/team2.jpeg","turn":"bowling"}
],
"stream": [
{"id":299,"obj_type":"eventhrow","text":"8.3 D Bollinger to RG Sharma","hawkeye":"http:\/\/static2.iplt20.com\/iphone\/hawkeye.html?cgid=ipl2012-01"},
{"id":300,"obj_type":"endofover","text":"end of over 20 - 3 runs"},
{"id":301,"obj_type":"commentary","text":"end of over 20 - 3 runs"}
@robinhayward
robinhayward / gist:3415093
Created August 21, 2012 12:46
Stream response
{
"response": {"score":[],"stream":[] },
"error": {"code":0,"message":""}
}
#import "NSNotificationCenter+RHKit.h"
@implementation NSNotificationCenter (RHKit)
- (void)addUniqueObserver:(id)observer selector:(SEL)aSelector name:(NSString *)aName object:(id)anObject {
[self removeObserver:observer name:aName object:anObject];
[self addObserver:observer selector:aSelector name:aName object:anObject];
}
{
{ "response" : [
{ "hex":"FF0000" }, "options": [ { "hex":"FF0001"}, { "hex":"FF0002"} ],
{ "hex":"GG0000" }, "options": [ { "hex":"FF0001"}, { "hex":"FF0002"} ]
],
"error" : { "code" : 0, "message" : "Entry saved ok" }
}
}
@robinhayward
robinhayward / gist:4045874
Created November 9, 2012 14:10
Entry Post
{"dob":"29/01/1984","firstname":"Robin","email":"hello@robhayward.co.uk","surname":"Hayward","uid":"0"}
@robinhayward
robinhayward / gist:4078857
Created November 15, 2012 14:25
NavigationController/TabBarController Transition
//
// FASWindowState.m
// FAS
//
// Created by Rob Hayward on 14/11/2012.
//
#import "FASWindowState.h"
#import "FASWelcomeViewController.h"
#import "FASTeamsTabBarController.h"
@robinhayward
robinhayward / gist:4111996
Created November 19, 2012 17:12
HTML Email Link
<p>We appreciate the time spent by many markets to complete our satisfaction survey. Your feedback is still highly appreciated.</p>
<p>Unfortunately the survey is now closed however if you would like to provide any general feedback please feel free to email Karen Peeters:</p>
<p><a href="mailto:karen.peeters@toyota-europe.com">karen.peeters@toyota-europe.com</a></p>
@robinhayward
robinhayward / gist:4125463
Created November 21, 2012 15:31
Evenly spacing items from their center
- (void)midPointsForContainerWidth:(CGFloat)containerWidth itemWidth:(CGFloat)itemWidth itemCount:(NSInteger)itemCount
{
CGFloat itemSpace = (containerWidth - (itemCount * itemWidth)) / (itemCount + 1);
for (int i = 0; i < itemCount; i++) {
CGFloat point = itemSpace + ((itemWidth / 2));
if (i > 0) {
point += (itemWidth * i);
point += (itemSpace * i);