Skip to content

Instantly share code, notes, and snippets.

@cameroncooke
cameroncooke / BTFormSheetViewController.h
Last active Sep 18, 2015
On iPad allows you to present a view controller in a form sheet with regular/regular traits
View BTFormSheetViewController.h
//
// BTFormSheetViewController.h
//
// Created by Cameron Cooke on 18/09/2015.
// Copyright © 2015 Brightec. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
@cameroncooke
cameroncooke / AppAPNSender.class.php
Created Dec 12, 2012
Apple Push Notification message sender
View AppAPNSender.class.php
<?php
/**
* Basic Apple Push Notification sender
*
* @package default
* @author Cameron Cooke (Brightec Ltd)
**/
class AppAPNSender
{
@cameroncooke
cameroncooke / keyboard.m
Last active Oct 16, 2015
The (not so) ultimate UIScrollView keyboard appearance and disappearance implementation
View keyboard.m
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@cameroncooke
cameroncooke / UIViewController+AutoRotation.m
Last active Oct 20, 2015
Propagates shouldAutorotate and supportedInterfaceOrientations calls to UITabBarController, UINavigationController and UISplitViewController.
View UIViewController+AutoRotation.m
//
// By Cameron Cooke at Brightec Ltd.
//
// Based on code from Stack Overflow: http://stackoverflow.com/a/15023156/248848
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
@cameroncooke
cameroncooke / unsign-xcode.sh
Last active Oct 20, 2016
Unsign Xcode 8+ so that 3rd party plug-ins can be used again
View unsign-xcode.sh
# Install unsign
wget https://github.com/steakknife/unsign/archive/master.zip ~/Downloads
cd ~/Downloads
unzip unsign-master.zip
cd unsign-master
make
cp ./unsign /usr/local/bin
# Copy Xcode
@cameroncooke
cameroncooke / navigation_bar_hide.swift
Created Jul 6, 2017
Hides navigation bar for current controller and shows it smoothly on push and hides it on pop.
View navigation_bar_hide.swift
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let navigationController = navigationController,
presentedViewController == nil {
navigationController.setNavigationBarHidden(true, animated: true)
}
}
@cameroncooke
cameroncooke / gist:13dac92bf35045e8095272dbdf34ba95
Created Apr 28, 2018
List top 10 .swift files sorted by number of lines
View gist:13dac92bf35045e8095272dbdf34ba95
find . -type f -name "*.swift" -exec wc -l {} + | sort -nr | head
@cameroncooke
cameroncooke / nsscreencast_downloader.rb
Created Aug 22, 2018
Downloads videos from nsscreencast (requires paid account)
View nsscreencast_downloader.rb
# Using this script downloads ALL the videos in NSScreencast.
# Usage: `EMAIL=your email PASSWORD=your password.`
require 'HTTParty'
require 'Nokogiri'
require 'pry'
require "mechanize"
require "parallel"
class Scraper
You can’t perform that action at this time.