Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tettoffensive's full-sized avatar

Stuart Tett tettoffensive

View GitHub Profile
@tettoffensive
tettoffensive / Anchor.swift
Created February 23, 2016 00:31
NSLayoutAnchor for 10.10/iOS8
//
// Anchor.swift
// AnchorTest
//
// Created by Jonathan Wight on 7/10/15.
// Copyright © 2015 schwa.io. All rights reserved.
//
#if os(OSX)
import AppKit
@tettoffensive
tettoffensive / IOMobileFramebuffer.h
Created December 11, 2015 21:46 — forked from anthonya1999/IOMobileFramebuffer.h
A recent disassembly of IOMobileFramebuffer framework
/* You may have to include your IOSurface header to compile, because of the GetLayerDefaultSurface function. If you do not have it, you may just uncomment the typedef to an IOSurface below. */
#include <stdio.h>
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
#define kIOMobileFramebufferError 0xE0000000
@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>
/*
* 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
// 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];
#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
@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
@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
#!/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"
/**
* 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