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 / update_xcode_plugins.sh
Created February 24, 2016 08:03 — forked from mokagio/update_xcode_plugins.sh
Script updating all plugins to be compatible with the latest Xcode and Xcode-beta
#!/bin/bash
#
# Updates all plug-ins to be compatible with the latest Xcode and Xcode-beta
#
plugins_location="~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins"
# Get Xcode's version
current_xcode_version="$(defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID)"

Values of macros from TargetConditionals.h.

Xcode 7 / iOS 9.1, tvOS 9.0, watchOS 2.0, OS X 10.11 SDKs

Macro 🖥 📱 📱sim ⌚️ ⌚️sim 📺 📺sim
TARGET_OS_MAC 1 1 1 1 1 1 1
TARGET_OS_IPHONE 0 1 1 1 1 1 1
TARGET_OS_IOS 0 1 1 0 0 0 0
TARGET_OS_WATCH 0 0 0 1 1 0 0
//: Convenience functions/extension on top of GCD.
import Dispatch
var MainQueue: dispatch_queue_t { return dispatch_get_main_queue() }
func GlobalQueue(qos: dispatch_qos_class_t = .Default) -> dispatch_queue_t
{
return dispatch_get_global_queue(qos, 0)
}
@onmyway133
onmyway133 / podforceupdate.sh
Created January 2, 2016 06:40 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@onmyway133
onmyway133 / Breakpoints_v2.xcbkptlist
Created December 28, 2015 08:39 — forked from Ashton-W/Breakpoints_v2.xcbkptlist
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
enum StringPaddingStyle {case Left, Right}
func padStringToLength(
sourceString: String,
destinationCount: Int,
paddingStyle: StringPaddingStyle = .Left,
paddingCharacter: Character = " "
) -> String {
let padCount = destinationCount - sourceString.characters.count,
padString = String(count: padCount, repeatedValue: paddingCharacter)
@onmyway133
onmyway133 / ADVPlaceholderViewController.h
Created December 17, 2015 02:17 — forked from advantis/ADVPlaceholderViewController.h
View controller supporting nested storyboard loading
//
// Copyright © 2013 Yuri Kotov
//
#import <UIKit/UIKit.h>
@interface ADVPlaceholderViewController : UIViewController
@end
@onmyway133
onmyway133 / Multiple Storyboard Usage.txt
Created December 17, 2015 02:05 — forked from aryaxt/Multiple Storyboard Usage.txt
Multiple Storyboard Usage
@interface UIStoryboard (Additions)
- (id __nullable)tryInstantiateViewControllerWithIdentifier:(NSString * __nonnull)identifier;
@end
@implementation UIStoryboard (Additions)
- (id)tryInstantiateViewControllerWithIdentifier:(NSString *)identifier {
@try {
return [self instantiateViewControllerWithIdentifier:identifier];
}
@catch (NSException *exception) {
@onmyway133
onmyway133 / swift_swizzle
Created December 16, 2015 16:44 — forked from ivanbruel/swift_swizzle
Swift Class Method Swizzle
//
// LHNetworking+Endpoint.swift
// magellan
//
// Created by Ivan Bruel on 09/04/15.
// Copyright (c) 2015 Passworks S.A. All rights reserved.
//
import Foundation
import Lighthouse
@onmyway133
onmyway133 / instruction.md
Created December 12, 2015 16:47 — forked from srph/instruction.md
Find a 9 letter string of characters that contains only letters from [acdegilmnoprstuw] such that the hash(the_string) is 910897038977002; If hash is defined with the given pseudo-code

Find a 9 letter string of characters that contains only letters from

acdegilmnoprstuw

such that the hash(the_string) is

910897038977002

if hash is defined by the following pseudo-code: