Skip to content

Instantly share code, notes, and snippets.

View robinhayward's full-sized avatar

Robin Hayward robinhayward

View GitHub Profile
@robinhayward
robinhayward / gist:4176327
Created November 30, 2012 15:13
Sports Formations
#import "FASFormationFactory.h"
@implementation FASFormationFactory
+ (void)test
{
FASFormationFactory *factory = [[FASFormationFactory alloc] init];
NSArray *map = [factory formationForContainer:CGSizeMake(320.0f, 400.0f) lines:[NSArray arrayWithObjects:@"1", @"4", @"4", @"2", nil] itemSize:CGSizeMake(67, 100)];
}
#!/bin/bash
#
# Release script
#
# A zip file will be produced with a release date and saved to the desktop
#
if [ "$1" = "" ]
then
echo "Error: $0 No project name given"
<!doctype html>
<head>
<title>Preloader Idea - (More than one way to skin pussy cat)</title>
<style>
.preloader-container { display: none; }
</style>
</head>
<body>
<div class="preloader-container">
@robinhayward
robinhayward / gist:4685941
Created January 31, 2013 20:04
JavaScript image preloader
function bookletPreloader(pageNumber, numberOfPagesToPreload, bookletId)
{
this.booklet = $(bookletId);
this.numberOfPagesToPreload = numberOfPagesToPreload;
this.pageNumber = pageNumber;
this.createPreloadContainer = function() {
var html = '<div class="booklet-preloader-container">ads</div>';
if (!this.containerElement)
{
$('body').append(html);
$('.class-for-page-elements').live("hover", function(event) {
var imageElement = event.element;
var url = $(imageElement).attr('src');
alert('You hovered an element with this url: ' + url);
$(imageElement).doSomeCoolZoomPluginStuff();
}
);
@robinhayward
robinhayward / gist:5413798
Created April 18, 2013 15:46
JSON Example
[
{ "string_example":"Rob Hayward", "another_string_example":"[email protected]", "number_example":1, "boolean_example":true },
{ "string_example":"Rob Haywarder", "another_string_example":"[email protected]", "number_example":2, "boolean_example":false },
{ "string_example":"Rob Haywarded", "another_string_example":"[email protected]", "number_example":3, "boolean_example":true }
]
// Download all assets from https://developer.apple.com/wwdc/videos
// Warning: might take up a lot of disk space
NodeList.prototype.toArray = function () {
return Array.prototype.slice.call(this);
};
[].concat.apply([], document.querySelectorAll("li.session").toArray().map(function(session){
var sessionID = session.id.match(/^\d+/)[0];
var title = session.querySelector(".title").innerText;
##
# Command to empty Trash with 35-pass security method. This is the most secure deletion,
# so you will not be able to recover any file deleted with this method.
# Replace <MAC_USER> with your Mac username.
##
srm -rfv /Users/<MAC_USER>/.Trash/*
##
# Command to empty Trash with 7-pass security method that meets the
#import <Foundation/Foundation.h>
@interface Node : NSObject
@property (nonatomic) NSInteger identifier;
@property (nonatomic, copy) NSString *value;
+ (Node *)nodeWithIdentifier:(NSInteger)identifier value:(NSString *)value;
@end
@implementation Node
+ (Node *)nodeWithIdentifier:(NSInteger)identifier value:(NSString *)value {
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of