Skip to content

Instantly share code, notes, and snippets.

@wangmingfu
wangmingfu / ARCHelper.h
Created November 19, 2012 18:24 — forked from nicklockwood/ARCHelper.h
ARC Helper
//
// ARC Helper
//
// Version 2.1
//
// Created by Nick Lockwood on 05/01/2012.
// Copyright 2012 Charcoal Design
//
// Distributed under the permissive zlib license
// Get the latest version from here:
@wangmingfu
wangmingfu / ARCMacro.h
Created November 19, 2012 18:27 — forked from HIRANO-Satoshi/ARCMacro.h
ARCMacro.h: Enables compilation both in ARC and non-ARC
/*
* ARCMacro.h 1.1 2012/05/29 https://gist.github.com/2823399
*
* ARCMacro.h realizes coexistence of both the ARC (Automatic
* Reference Counting) mode and the Non-ARC mode of Objective-C
* in the same source code. This macro works for iOS and Mac OS X.
*
* This is a by-product of joint research by AIST and The University of Ryukyu.
* HIRANO Satoshi (AIST), NAKAMURA Morikazu (U. Ryukyu) and GUAN Senlin (U. Ryukyu)
*
Code from Clutch, Thanks. https://github.com/KJCracks/Clutch
#define mobileinstallationcache @"/private/var/mobile/Library/Caches/com.apple.mobile.installation.plist"
typedef NSDictionary* (*MobileInstallationLookup)(NSDictionary *options);
@interface UIDevice (ProcessesAdditions)
- (NSArray *)runningProcesses;
@end
// .m
#import <sys/sysctl.h>
@implementation UIDevice (ProcessesAdditions)
- (NSArray *)runningProcesses {
@wangmingfu
wangmingfu / gist:6f42ad9618e092c391d6
Last active August 29, 2015 14:20
实体序列化
+ (NSData *)jsonDataFromObject:(id)object;
{
static Class NSObjectClass;
static NSCharacterSet *ClassRestrictiveCharacterSet;
if( !NSObjectClass )
{
NSObjectClass = [NSObject class];
ClassRestrictiveCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@" @\""];
}
@wangmingfu
wangmingfu / gist:a0ea62d2ca2ab0c80848
Created February 23, 2016 09:21 — forked from amokan/gist:3881064
jenkins-cli commands (v1.485)
build
Builds a job, and optionally waits until its completion.
cancel-quiet-down
Cancel the effect of the "quiet-down" command.
clear-queue
Clears the build queue
connect-node
Reconnect to a node
copy-job
Copies a job.
@wangmingfu
wangmingfu / AVAsset+VideoOrientation.h
Created August 4, 2017 01:29 — forked from luca-bernardi/AVAsset+VideoOrientation.h
Find the video orientation of an AVAsset. (Useful if you need to send the video to a remote server)
//
// AVAsset+VideoOrientation.h
//
// Created by Luca Bernardi on 19/09/12.
// Copyright (c) 2012 Luca Bernardi. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
typedef enum {
LBVideoOrientationUp, //Device starts recording in Portrait