Skip to content

Instantly share code, notes, and snippets.

View AdamSwinden's full-sized avatar

Adam Swinden AdamSwinden

View GitHub Profile
/**
* Set Store Currency
*/
function setStoreCurrency(globalCurrency) {
var currencySetUkButton = $( '.currencySetUk' ),
currencySetEuButton = $( '.currencySetEu' ),
currencySetUsButton = $( '.currencySetUs' ),
body = $( 'body' );
@AdamSwinden
AdamSwinden / sfsafariviewcontroller_workaround.swift
Last active February 10, 2016 17:59
Workaround for SFSafariViewController quick swipe bug. (https://openradar.appspot.com/23871289)
let viewController = SFSafariViewController(URL: url)
presentViewController(viewController, animated: true) {
for view in viewController.view.subviews {
if let recognisers = view.gestureRecognizers {
for gestureRecogniser in recognisers where gestureRecogniser is UIScreenEdgePanGestureRecognizer {
gestureRecogniser.enabled = false
@AdamSwinden
AdamSwinden / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@AdamSwinden
AdamSwinden / NSString+HTMLEntities.h
Created October 10, 2014 15:08
NSString+HTMLEntities
//
// NSString+HTMLEntities.h
//
// Created by Adam Swinden on 10/10/2014.
// Copyright (c) 2014 Adam Swinden. All rights reserved.
//
#import <Foundation/Foundation.h>
@AdamSwinden
AdamSwinden / gist:3858370
Created October 9, 2012 12:03
Animation Curves
// Quadratic
GLfloat QuadraticEaseOut(float t, float start, float end) {
if (t < 0.0f) t = 0.0f;
if (t > 1.0f) t = 1.0f;
return -end * t*(t-2) + start;
}
@AdamSwinden
AdamSwinden / UIScreen+AspectRation.h
Created September 19, 2012 06:12
UIScreen Aspect Ratio (Detecting 4" display)
//
// UIScreen+AspectRatio.h
//
// Created by Adam Swinden on 14/09/2012.
// Copyright (c) 2012 The OTHER Media. All rights reserved.
//
#import <UIKit/UIKit.h>
@AdamSwinden
AdamSwinden / NSURL+QueryAttributes.m
Created June 29, 2012 11:21
NSURL Query Attributes
//
// NSURL+QueryAttributes.m
//
// Created by Adam Swinden on 29/06/2012.
// Copyright (c) 2012 The OTHER Media. All rights reserved.
//
#import "NSURL+QueryAttributes.h"
@implementation NSURL (QueryAttributes)
@AdamSwinden
AdamSwinden / gist:1358867
Created November 11, 2011 18:59
Using URL scheme to open Settings.app
// Turn on Location Services?
[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]];
// Set up Twitter?
[NSURL URLWithString:@"prefs:root=TWITTER"]];
// Hook up a Bluetooth device?
[NSURL URLWithString:@"prefs:root=General&path=Bluetooth"]];
// Change app settings
@AdamSwinden
AdamSwinden / gist:1029341
Created June 16, 2011 14:35
Date with Time Component Removed
- (NSDate*)dateWithTimeComponentRemoved:(NSDate *)date {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:self];
return [calendar dateFromComponents:components];
}
@AdamSwinden
AdamSwinden / gist:966300
Created May 11, 2011 11:18
Xcode 4 .gitignore
build/
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
*.xcworkspace
xcuserdata