Skip to content

Instantly share code, notes, and snippets.

View onmyway133's full-sized avatar
😇
What you don't know is what you haven't learned

Khoa onmyway133

😇
What you don't know is what you haven't learned
View GitHub Profile
@onmyway133
onmyway133 / README.md
Created August 29, 2016 20:16 — forked from bomberstudios/README.md
Loading a Cocoa Framework in a Sketch Plugin

This is what Craft does:

function loadFramework(pluginRoot) {
  if (NSClassFromString('PanelsManager') == null) {
    var mocha = [Mocha sharedRuntime];
    return [mocha loadFrameworkWithName:'Panels' inDirectory:pluginRoot];
  } else {
    return true;
 }
@onmyway133
onmyway133 / Fastfile-example
Created August 19, 2016 15:14 — forked from ricardopereira/Fastfile-example
Automate some iOS development processes with Fastlane
fastlane_version "1.99.0"
REQUIRED_XCODE_VERSION = "7.3.1"
default_platform :ios
platform :ios do
before_all do |lane, options|
ENV["SLACK_URL"] = "https://hooks.slack.com/services/???"
end
@onmyway133
onmyway133 / wwdc16.md
Created July 21, 2016 13:02 — forked from mackuba/wwdc16.md
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra

@onmyway133
onmyway133 / gist:6d1a7a11b0ca787bd8cc4732f46f9338
Created June 21, 2016 08:50 — forked from steipete/ios-xcode-device-support.sh
Using Xcode 7.3.1 and iOS 10 devices
// The trick is to copy the DeviceSupport folder from the beta to the stable version.
cp -r /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.0\ \(14A5261u\) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
// Then restart Xcode. You might need to do that for every beta of iOS 10/Xcode 8.
@onmyway133
onmyway133 / add_lib_with_xcodeproj.rb
Created June 9, 2016 10:54 — forked from niklasberglund/add_lib_with_xcodeproj.rb
Example of how to use the ruby gem xcodeproj to add a library to the Frameworks group of a project. Forked and updated to work with updated version of xcodeproj.
require 'xcodeproj'
project_path = "your_project_path";
# Create project object
project = Xcodeproj::Project.new(project_path);
lib_path = "your_lib_path";
# Add the lib file as a reference
libRef = project['Frameworks'].new_file(lib_path);
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
// Basically, these are if and else statements respectively
// without the opposite clause
func when(test: @autoclosure () -> Bool, action: () -> ()) {
if test() { action() }
}
func unless(test: @autoclosure () -> Bool, action: () -> ()) {
if !test() { action() }
}
import UIKit
class FloatingButtonController: UIViewController {
private(set) var button: UIButton!
required init?(coder aDecoder: NSCoder) {
fatalError()
}
@onmyway133
onmyway133 / curl.md
Created April 24, 2016 19:02 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@onmyway133
onmyway133 / Image.m
Created April 5, 2016 11:04
iOS: How to retrieve image dimensions without loading CGImage into memory
// This method requires ImageIO.framework
#import <ImageIO/ImageIO.h>
- (CGSize)sizeOfImageAtURL:(NSURL *)imageURL
{
// With CGImageSource we avoid loading the whole image into memory
CGSize imageSize = CGSizeZero;
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageURL, NULL);
if (source) {
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCGImageSourceShouldCache];