Skip to content

Instantly share code, notes, and snippets.


Limon Limon-O-O

View GitHub Profile
JamesMenetrey /
Last active Sep 9, 2020
Install Oh-My-Zsh + iTerm2 with Solarized + System-wide console in 2017 (macOS)

Install iTerm2 with Solarized in 2017

Here is the looks and feel of your terminal once the tutorial has been applied on your system:

Install iTerm2

Using Homebrew:

View DumpEquatable.swift
extension String {
init<T>(dumping x: T) {
dump(x, to: &self)
func assertDumpsEqual<T>(_ lhs: @autoclosure () -> T, _ rhs: @autoclosure () -> T, file: StaticString = #file, line: UInt = #line) {
assert(String(dumping: lhs()) == String(dumping: rhs()), "Expected dumps to be equal.", file: file, line: line)
medvedzzz / UIApplication+VisibleViewControllers.swift
Last active Mar 23, 2017
UIApplication Swift category to add visibleViewControllers property
View UIApplication+VisibleViewControllers.swift
import UIKit
extension UIApplication {
private struct AssociatedObjectsKeys {
static var visibleViewControllersPointers = "UIApplication_visibleViewControllersPointers"
fileprivate var visibleViewControllersPointers: NSPointerArray {
var pointers = objc_getAssociatedObject(self, &AssociatedObjectsKeys.visibleViewControllersPointers) as! NSPointerArray?
marcoarment / FCPrivateBatteryStatus.m
Created Jan 29, 2016
How to get raw battery info (mAh remaining, etc.) from iOS using private APIs. For internal testing only, NOT APP STORE DISTRIBUTION!
View FCPrivateBatteryStatus.m
#import <Foundation/Foundation.h>
#include <dlfcn.h>
NSDictionary *FCPrivateBatteryStatus()
static mach_port_t *s_kIOMasterPortDefault;
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options);
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name);
leichunfeng / NSNull+LCFMessageForwarding.h
Last active Apr 6, 2016
通过重写 NSNull 的消息转发方法,来避免给 [NSNull null] 发消息时的闪退问题
View NSNull+LCFMessageForwarding.h
// NSNull+LCFMessageForwarding.h
// NSNull
// Created by leichunfeng on 15/12/22.
// Copyright © 2015年 leichunfeng. All rights reserved.
#import <Foundation/Foundation.h>
plumhead / StringSize.swift
Created Sep 15, 2015
String extension to find the layout size of a String with specified attributes.
View StringSize.swift
extension String {
func size(withAttributes attrs: [String:AnyObject], constrainedTo box: NSSize) -> NSRect {
let storage = NSTextStorage(string: self)
let container = NSTextContainer(containerSize: NSSize(width: box.width, height: box.height))
let layout = NSLayoutManager()
storage.addAttributes(attrs, range: NSMakeRange(0, storage.length))
container.lineFragmentPadding = 0.0
let _ = layout.glyphRangeForTextContainer(container)
jellybeansoup /
Last active Sep 18, 2020
Script for Incrementing Version Numbers
# Link: <>
# A command-line script for incrementing build numbers for all known targets in an Xcode project.
# This script has two main goals: firstly, to ensure that all the targets in a project have the
# same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values
# can cause a warning when submitting to the App Store. Secondly, to ensure that the build number
# is incremented appropriately when git has changes.
nixzhu / cancelableDelayTask.swift
Last active Mar 11, 2017
Cancelable Delay Task
View cancelableDelayTask.swift
import Foundation
typealias CancelableTask = (cancel: Bool) -> Void
func delay(time: NSTimeInterval, work: dispatch_block_t) -> CancelableTask? {
var finalTask: CancelableTask?
var cancelableTask: CancelableTask = { cancel in
if cancel {
SheffieldKevin / movietransitions.swift
Last active Nov 23, 2020
Make a movie with transitions with AVFoundation and swift
View movietransitions.swift
// main.swift
// mutablecomposition
// Created by Kevin Meaney on 24/08/2015.
// Copyright (c) 2015 Kevin Meaney. All rights reserved.
import Foundation
tpinto /
Last active Jul 20, 2017
Xcode: Automatic version and build number for iOS apps on Info.plist and Settings.bundle -
# Tips from:
# Reference from:
# Get the correct path for the git binary
git=`sh /etc/profile; which git`
# Save paths for the project and target Info.plist