Skip to content

Instantly share code, notes, and snippets.

@hyuni
hyuni / scrollView
Created July 18, 2018 13:31 — forked from chrisswong/scrollView
WWDC scrollView sessions
2009 - Mastering iPhone Scroll Views
UIScrollView Basics
2010 - Designing Apps with Scroll Views
Photo browsing
Tiling
2011 - Advanced Scroll View Techniques
Infinite scrolling
Stationary header views
@hyuni
hyuni / wwdc.sh
Created July 18, 2018 13:31 — forked from idiomatic/wwdc.sh
Fetch WWDC videos, slides, and sample code.
#!/bin/bash
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ]
resolution=${1:-SD}
year=${2:-2015}
shift
shift
ids=$*
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]')
func switchRootViewController(rootViewController: UIViewController, animated: Bool, completion: (() -> Void)?) {
if animated {
UIView.transitionWithView(window, duration: 0.5, options: .TransitionCrossDissolve, animations: {
let oldState: Bool = UIView.areAnimationsEnabled()
UIView.setAnimationsEnabled(false)
self.window!.rootViewController = rootViewController
UIView.setAnimationsEnabled(oldState)
}, completion: { (finished: Bool) -> () in
if completion {
completion!()
@hyuni
hyuni / UIView+RoundedCorners.h
Created July 30, 2018 05:35 — forked from bobmoff/UIView+RoundedCorners.h
Add rounded corners to any view using layer mask.
#import <UIKit/UIKit.h>
@interface UIView (RoundedCorners)
- (void)setRoundedCorners:(UIRectCorner)corners radius:(CGSize)size;
@end
@hyuni
hyuni / .zshrc
Created August 5, 2018 01:16 — forked from kidager/.zshrc
ZSH Powerline installation
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
# Uncomment the following line to use case-sensitive completion.
@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}")
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
import UIKit
enum BackgroundingSource: String {
case lock = "lock", homeOrSwitch = "homeOrSwitch"
}
protocol BackgroundingSourceTrackerDelegate: class {
func backgroundingSourceTracker(_ backgroundingSourceTracker: BackgroundingSourceTracker, didTrackBackgroundingWith source: BackgroundingSource)
}
@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
@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