Skip to content

Instantly share code, notes, and snippets.

Avatar
🍋

Limon Limon-O-O

🍋
View GitHub Profile
@Limon-O-O
Limon-O-O / NSURL Parseer.md
Last active Nov 23, 2015
Extension to access the URL Parameters within your NSURL.
View NSURL Parseer.md

Producter Tips

extension NSURL {
    var prt_URLItems: [String: String]? {

        let components = NSURLComponents(URL: self, resolvingAgainstBaseURL: false)

        guard let items = components?.queryItems else {
            return nil
View Matching Optional.md

假设服务器返回以上的JSON,客户端需要根据文章类型来作不同的布局。

enum Occupation: String {
  case AppSo = "app"
  case Number = "number"
}

let typeString = "mindStore"

switch Occupation(rawValue: typeString) {
@Limon-O-O
Limon-O-O / FCPrivateBatteryStatus.m
Created Mar 20, 2016 — forked from marcoarment/FCPrivateBatteryStatus.m
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);
@Limon-O-O
Limon-O-O / xcode-auto-version.sh
Created Jun 27, 2016 — forked from tpinto/xcode-auto-version.sh
Xcode: Automatic version and build number for iOS apps on Info.plist and Settings.bundle - http://www.tiagopinto.pt/blog/2014/11/10/xcode-version-build-number-ios-info-plist-settings-bundle/
View xcode-auto-version.sh
# Tips from: http://xcodehelp.blogspot.ie/2012/05/add-version-number-to-settings-screen.html
# Reference from: https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html
# Get the correct path for the git binary
git=`sh /etc/profile; which git`
# Save paths for the project and target Info.plist
projectPlistPath="${PROJECT_DIR}/${INFOPLIST_FILE}"
targetPlistPath="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
@Limon-O-O
Limon-O-O / MediaFormat.md
Created Jul 2, 2016
Video file formats supported in iPhone
View MediaFormat.md
    import AVFoundation.AVMediaFormat
    enum MediaFormat {
        case MOV
        case MP4
        case M4V

        var filenameExtension: String {
            switch self {
            case .MOV:
@Limon-O-O
Limon-O-O / movietransitions.swift
Created Jul 24, 2016 — forked from SheffieldKevin/movietransitions.swift
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
View MergeAssets.swift
//
// Segment.swift
// MED
//
// Created by Limon on 6/28/16.
// Copyright © 2016 MED. All rights reserved.
//
import AVFoundation
@Limon-O-O
Limon-O-O / CyanifyOperation.swift
Created Sep 4, 2016
Defines a subclass of NSOperation that adjusts the color of a video file.
View CyanifyOperation.swift
//
// CyanifyOperation.swift
// MED
//
// Created by Limon on 2016/7/19.
// Copyright © 2016年 MED. All rights reserved.
//
import AVFoundation
import Dispatch
@Limon-O-O
Limon-O-O / TransitionCompositionBuilder.swift
Last active Dec 2, 2020
Merging videos with cross-fade effect using AVFoundation
View TransitionCompositionBuilder.swift
//
// TransitionComposition.swift
// MED
//
// Created by Limon on 7/26/16.
// Copyright © 2016 MED. All rights reserved.
//
import AVFoundation
@Limon-O-O
Limon-O-O / AVCaptureDevice+FrameRate.swift
Created Oct 31, 2016
Control video frame rate with AVFoundation
View AVCaptureDevice+FrameRate.swift
extension AVCaptureDevice {
/// http://stackoverflow.com/questions/21612191/set-a-custom-avframeraterange-for-an-avcapturesession#27566730
func configureDesiredFrameRate(_ desiredFrameRate: Int) {
var isFPSSupported = false
do {
if let videoSupportedFrameRateRanges = activeFormat.videoSupportedFrameRateRanges as? [AVFrameRateRange] {
You can’t perform that action at this time.