Skip to content

Instantly share code, notes, and snippets.

@tyrone-sudeium
tyrone-sudeium / gist:5583727
Created May 15, 2013 12:42
A spinning disabled overlay, akin to ones you'd find on action bars in MMOs.
//
// SDTimedDisableOverlayView.m
// TimedDisabledAnimation
//
// Created by Tyrone Trevorrow on 15-05-13.
// Copyright (c) 2013 Sudeium. All rights reserved.
//
#import "SDTimedDisableOverlayView.h"
@tyrone-sudeium
tyrone-sudeium / FireworksView.mm
Created February 27, 2013 03:44
Cloudsdale's fireworks background view.
//
// FireworksView.m
// Cloudsdale
//
// Created by Tyrone Trevorrow on 24/05/12.
// Copyright (c) 2012 Cloudsdale. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
#import "FireworksView.h"
@tyrone-sudeium
tyrone-sudeium / copy_propertyList_recursive.mm
Created February 25, 2013 01:15
Same as the built-in class_copyPropertyList except it traverses the class hierarchy too.
static objc_property_t* class_copyPropertyList_recursive(Class aClass, unsigned int *outCount)
{
unsigned int total = 0;
objc_property_t *contiguousList = nil;
objc_property_t *ptr = nil;
unsigned int ptrOffset = 0;
unsigned int listLen = 0;
unsigned int const increment = 32;
contiguousList = malloc(sizeof(objc_property_t) * increment);
@tyrone-sudeium
tyrone-sudeium / wakeonphone.rb
Created January 26, 2013 11:13
Something I wrote a lifetime ago that'll send a Wake On LAN magic packet to a specified computer when a specified device joins the WiFi zone.
require 'rubygems'
require 'snmp'
require 'socket'
iPhones = [ "00:23:32:f4:c4:a1" ]
pcs = [ "00:1B:21:29:70:1D" ]
wakeUp = Hash::new
woken = Hash::new
seen = Hash::new
@tyrone-sudeium
tyrone-sudeium / gist:4594251
Last active December 11, 2015 11:29
A horizontally paging, but vertically-flowing UICollectionViewFlowLayout. Oddly, gists don't let you enter markdown into the description, so see the comment below for a description of what it does. Make sure you set its flow direction to **vertical**, even though it'll page horizontally.
@interface HorizontallyPagingCollectionViewFlowLayout : UICollectionViewFlowLayout
@end
@implementation HorizontallyPagingCollectionViewFlowLayout
- (CGSize) collectionViewContentSize
{
CGSize superSize = [super collectionViewContentSize];
CGSize frameSize = self.collectionView.frame.size;
@tyrone-sudeium
tyrone-sudeium / gitpush.sh
Created July 20, 2012 01:51
Push to Git and Notify Skype
#!/bin/bash
REMOTE="origin"
if [ $# -gt 0 ]
then
REMOTE="$1"
fi
BRANCH=$(git symbolic-ref -q HEAD)
BRANCH=${BRANCH##refs/heads/}
BRANCH=${BRANCH:-HEAD}
@tyrone-sudeium
tyrone-sudeium / RoundedRectUtility.h
Created July 18, 2012 02:07
A utility to create stretchable rounded rectangle UIImages with various customisable properties
//
// RoundedRectUtility.h
// Cloudsdale
//
// Created by Tyrone Trevorrow on 28/02/12.
// Copyright (c) 2012 Cloudsdale. All rights reserved.
//
#import <Foundation/Foundation.h>
@tyrone-sudeium
tyrone-sudeium / British.h
Created February 23, 2012 23:38
Add some sophistication to your C code, Jolly-o!
#ifndef BRITISH_H
#define BRITISH_H
#define perchance if
#define otherwise else
#define what_about switch
#define perhaps case
#define splendid break
#define on_the_off_chance default