This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find * -name "*.js" -print0 | xargs -0 /usr/bin/dos2unix | |
find * -name "*.css" -print0 | xargs -0 /usr/bin/dos2unix | |
find * -name "*.htm" -print0 | xargs -0 /usr/bin/dos2unix | |
find * -name "*.html" -print0 | xargs -0 /usr/bin/dos2unix | |
find * -name "*.php" -print0 | xargs -0 /usr/bin/dos2unix | |
#etc | |
#where /usr/bin/dos2unix is: | |
#!/bin/sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(empty($_SERVER['HTTPS'])) | |
{ | |
// If not, redirect | |
$newurl = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; | |
header("location: $newurl"); | |
exit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# View Controller: | |
App.delegate.instance_variable_get("@window").rootViewController | |
# View Controller when using UINavigationController | |
App.delegate.instance_variable_get("@window").rootViewController.topViewController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf UIWindow.keyWindow._autolayoutTrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I can never, ever remember how to do this, so here's how: | |
failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
NSData *data= error.userInfo[AFNetworkingOperationFailingURLResponseDataErrorKey]; | |
NSString *failureResponse = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | |
NSLog(@"Failure response: %@", failureResponse); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// was used when API address moved but apps were live on app store. | |
$ch = curl_init(); | |
$path = $_SERVER['REQUEST_URI']; | |
$path = str_replace('/api/index.php','',$path); | |
$path = str_replace('/api/','/',$path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by Ian Dundas on 16/03/15. | |
// | |
#import "UIImagePickerController+cats.h" | |
#import <AVFoundation/AVFoundation.h> | |
#import "Photos/Photos.h" | |
/* | |
example usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol ThemeScheme{ | |
var fonts: FontScheme {get} | |
var colours: ColourScheme {get} | |
} | |
public struct Theme: ThemeScheme{ | |
public let fonts: FontScheme | |
public let colours: ColourScheme | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returns a random Emoji 🌿 | |
extension String{ | |
func randomEmoji()->String{ | |
let range = 0x1F601...0x1F64F | |
let ascii = range.startIndex + Int(arc4random_uniform(UInt32(range.count))) | |
let emoji = String(UnicodeScalar(ascii)) | |
return emoji | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# strip out iBooks citation | |
sed -E -e 's/^[ ]?[0-9]* //g' | sed -E -e 's/“[ ]?[0-9]?[ ]?//g' | sed -E -e 's/”$//g' | sed -E -e 's/^(Excerpt From).*//g' |