Skip to content

Instantly share code, notes, and snippets.

View tettoffensive's full-sized avatar

Stuart Tett tettoffensive

View GitHub Profile
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
#import <Foundation/Foundation.h>
#import <AssetsLibrary/AssetsLibrary.h>
@interface ALAssetsLibrary (EEEConcurrency)
- (NSUInteger)eee_enumerateGroupsLockedWithTypes:(ALAssetsGroupType)types
usingBlock:(ALAssetsLibraryGroupsEnumerationResultsBlock)enumerationBlock
failureBlock:(ALAssetsLibraryAccessFailureBlock)failureBlock;
@end
/**
* Wait for [AssestLibrary enumerateGroupsWithTypes: usingBlock:] to be completed, or how other
* people call it, [AssestLibrary enumerateGroupsWithTypes: usingBlock:] Asynchronous
* The following method should not be called on main thread, use
* [self performSelectorInBackground:@selector(getAllAssets) withObject:nil];
* to excecute it
*/
- (void)getAllAssets
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
@tettoffensive
tettoffensive / change_app_icon.sh
Created February 2, 2015 20:39
changing app icon script
commit=`git rev-parse --short HEAD`
branch=`git rev-parse --abbrev-ref HEAD`
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"`
function processIcon() {
export PATH=$PATH:/usr/local/bin
base_file=$1
base_path=`find ${SRCROOT} -name $base_file`
if [[ ! -f ${base_path} || -z ${base_path} ]]; then
@tettoffensive
tettoffensive / slackpost
Last active August 26, 2016 09:01 — forked from dopiaza/slackpost
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
// add child view
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
[self addChildViewController:controller];
controller.view.frame = CGRectMake(0, 44, 320, 320);
[self.view addSubview:controller.view];
[controller didMoveToParentViewController:self];
// remove child view
UIViewController *vc = [self.childViewControllers lastObject];
[vc.view removeFromSuperview];
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@tettoffensive
tettoffensive / UIImage+Blur.h
Last active August 29, 2015 14:27 — forked from fmtonakai/UIImage+Blur.h
UIImage Blur
//
// UIImage+Blur.h
// HTTPLoaderTest
//
// Created by masaki.fuke on 12/08/14.
// Copyright (c) 2012年 masaki.fuke. All rights reserved.
//
#import <UIKit/UIKit.h>