Skip to content

Instantly share code, notes, and snippets.

View tombuildsstuff's full-sized avatar
🏖️

Tom Harvey tombuildsstuff

🏖️
View GitHub Profile
@robashton
robashton / BloatedController.cs
Created June 13, 2011 16:32
Partially Refactored controller
public class ReducedController : Controller
{
private readonly IContainProducts productRepository;
private readonly ISearchForProducts productsIndex;
private readonly IContainCustomers customerRepository;
private readonly IShipProducts productShipper;
private readonly ICoordinateSales salesCatalog;
public ReducedController(
IContainProducts productRepository,
@scruffyfox
scruffyfox / gist:1333916
Created November 2, 2011 15:23 — forked from codeincontext/gist:1285806
Javascript function to show how long ago a timestamp was as a pretty string
/**
* Converts a timestamp to how long ago syntax
* @param time The time in seconds
* @return The formatted time
*/
public static String timeAgo(int time)
{
Unit[] units = new Unit[]
{
new Unit("s", 60, 1),
@bjhomer
bjhomer / UIWebView+AccessoryHiding.m
Created March 16, 2012 05:03
Hiding the inputAccessoryView of a UIWebView
#import <objc/runtime.h>
#import <UIKit/UIKit.h>
@interface UIWebView (HackishAccessoryHiding)
@property (nonatomic, assign) BOOL hackishlyHidesInputAccessoryView;
@end
@implementation UIWebView (HackishAccessoryHiding)
static const char * const hackishFixClassName = "UIWebBrowserViewMinusAccessoryView";
@tombuildsstuff
tombuildsstuff / hack.sh
Created March 31, 2012 11:35 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@mayoff
mayoff / makeAnimatedGif.m
Created February 16, 2013 23:00
Example of creating an animated GIF on iOS, with no 3rd-party code required. This should also be easy to port to OS X.
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@guifromrio
guifromrio / teamcity-agent-ubuntu.md
Last active October 21, 2022 12:35
Instructions to Setup Teamcity Agent on EC2 Ubuntu 12.04.2 Linux with NodeJS and PhantomJS
@danielmarbach
danielmarbach / AssemblyInfo.cs
Created July 22, 2013 17:56
My InMemory approach for unit testing and acceptance testing with NServiceBus which uses custom IBus, FluentAssertions and NUnit actions
[assembly: WithBus]
@steipete
steipete / DevelopmentEnviromentDetector.m
Last active October 30, 2019 03:49
Detect if you're currently running a development version or an App Store/Ad Hoc version.
static BOOL PSPDFIsDevelopmentBuild(void) {
#if TARGET_IPHONE_SIMULATOR
return YES;
#else
static BOOL isDevelopment = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// There is no provisioning profile in AppStore Apps.
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]];
if (data) {
#!/bin/bash
git branch --merged | while read line
do
# If the line is in the format '* master' (indicating the current branch),
# this will be effectively empty, so we don't somehow delete the current
# branch
BRANCH=`echo "$line" | awk -F '*' '{ print $1 }'`
if [ -z "$BRANCH" ]
@ulrikdamm
ulrikdamm / gist:a9edb3516db7e9a13829
Created May 26, 2014 11:17
Xcide quicklook for UIColor
@interface UIColor (WBDebugExtensions)
@end
@implementation UIColor (DebugExtensions)
- (id)debugQuickLookObject {
UIGraphicsBeginImageContext(CGSizeMake(128, 128));
[self setFill];
[[UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 128, 128)] fill];