Skip to content

Instantly share code, notes, and snippets.

@hyuni
hyuni / gist:552e5fcd28d87d0f6ee4b28fa536cab2
Created January 12, 2019 05:25 — forked from HarryGoodwin/gist:4528d6419915258e54b2f8c804687808
Attributed string bullet points - Swift
//
// ViewController.swift
// BulletList
//
// Created by Harry Goodwin on 09/04/2016.
// Copyright © 2016 GG. All rights reserved.
//
import UIKit
@hyuni
hyuni / Unsafe Bit Cast.swift
Created December 18, 2018 13:00 — forked from JadenGeller/Unsafe Bit Cast.swift
A Quick Overview of Unsafe Bit Cast
// Let's declare two structs that with different variables and different boolean values:
struct A {
let x = true
}
struct B {
let y = false
}
@hyuni
hyuni / peekFunc.swift
Last active December 17, 2018 13:08 — forked from dankogai/peekFunc.swift
Get the internal function pointer in swift
/// See
/// https://github.com/rodionovd/SWRoute/wiki/Function-hooking-in-Swift
/// https://github.com/rodionovd/SWRoute/blob/master/SWRoute/rd_get_func_impl.c
/// to find why this works
func peekFunc<A, R>(_ f: @escaping (A) -> R) -> (fp: Int, ctx: Int) {
typealias IntInt = (Int, Int)
let (_, lo) = unsafeBitCast(f, to: IntInt.self)
let offset = MemoryLayout<Int>.size == 8 ? 16 : 12
let ptr = UnsafePointer<Int>(bitPattern: lo + offset)!
@hyuni
hyuni / iterm2-solarized.md
Created December 6, 2018 13:37 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@hyuni
hyuni / Git push deployment in 7 easy steps.md
Created December 2, 2018 22:09 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@hyuni
hyuni / install_janus.sh
Created September 9, 2018 06:45 — forked from anildigital/install_janus.sh
Install Janus WebRTC Gateway on macOS
brew install jansson libnice openssl libusrsctp libmicrohttpd libwebsockets cmake rabbitmq-c sofia-sip opus libogg glib pkg-config gengetopt
wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz
tar xvf v1.5.4.tar.gz
cd libsrtp-1.5.4
./configure --prefix=/usr/local/libsrtp
make
sudo make install
git clone [email protected]:meetecho/janus-gateway.git
@hyuni
hyuni / Storage.swift
Created August 10, 2018 21:26 — forked from saoudrizwan/Storage.swift
Helper class to easily store and retrieve Codable structs from/to disk. https://medium.com/@sdrzn/swift-4-codable-lets-make-things-even-easier-c793b6cf29e1
import Foundation
public class Storage {
fileprivate init() { }
enum Directory {
// Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the <Application_Home>/Documents directory and will be automatically backed up by iCloud.
case documents
import UIKit
enum BackgroundingSource: String {
case lock = "lock", homeOrSwitch = "homeOrSwitch"
}
protocol BackgroundingSourceTrackerDelegate: class {
func backgroundingSourceTracker(_ backgroundingSourceTracker: BackgroundingSourceTracker, didTrackBackgroundingWith source: BackgroundingSource)
}
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
@hyuni
hyuni / versioning_git.sh
Created August 5, 2018 01:21
increment versioning for xcode app
INFOPLIST="${PROJECT_DIR}/${INFOPLIST_FILE}"
buildNumber=$(git rev-list HEAD --count)
echo $buildNumber
VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
echo $VERSIONNUM
#VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")