Skip to content

Instantly share code, notes, and snippets.

xmgtih

Block or report user

Report or block xmgtih

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@madhikarma
madhikarma / build_framework.sh
Created Oct 13, 2015
Script to build a framework for multiple architectures
View build_framework.sh
# Merge Script
# http://code.hootsuite.com/an-introduction-to-creating-and-distributing-embedded-frameworks-in-ios/
# 1
# Set bash script to exit immediately if any commands fail.
set -e
# 2
# Setup some constants for use later on.
@cromandini
cromandini / universal-framework.sh
Last active Jun 27, 2019 — forked from cconway25/gist:7ff167c6f98da33c5352
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
View universal-framework.sh
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
View git-stash.md

git stash用于保存和恢复工作进度

  • git stash

    保存当前的工作进度。会分别对暂存区和工作区的状态进行保存

  • git stash save "message..."

    这条命令实际上是第一条 git stash 命令的完整版

View AVPlayerCaching.m
//
// ViewController.m
// AVPlayerCaching
//
// Created by Anurag Mishra on 5/19/14.
// Sample code to demonstrate how to cache a remote audio file while streaming it with AVPlayer
//
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
@mralexgray
mralexgray / logProperties.m
Last active Dec 10, 2018
A concise category on NSObject to log all declared properties, pretty-like, using minimal SLOC.
View logProperties.m
#import <objc/message.h>
#define DECORATE printf("\n\n+*%%$%%*+-+*%%$%%*+-+*%%$-+*%%$%%*+-+*%%$%%*+-+*%%$-+*%%$%%*+-+*%%$%%*+-\n\n")
@implementation NSObject (logProperties) - (void) logProperties { DECORATE; @autoreleasepool { unsigned int propCt = 0;
const char * myName = [self.description substringWithRange:
(NSRange){1,[self.description rangeOfString:@":"].location-1}].UTF8String;
objc_property_t *pA = class_copyPropertyList(self.class, &propCt);
for (int i = 0; i < propCt; i++) { NSString *name; printf("%s [%s] = %s\n", myName,
(name = [NSString.alloc initWithUTF8String:property_getName(pA[i])]).UTF8String,
[objc_msgSend(self,NSSelectorFromString(name)) description].UTF8String);
} free(pA); } DECORATE; }
@paolonl
paolonl / UIImage+Rotation
Last active Jul 3, 2018
Rotate UIImage/CGImageRef
View UIImage+Rotation
- (UIImage *)rotateImage:(UIImage *)image ofAngle:(CGFloat)degrees {
CGImageRef imgRef = image.CGImage;
CGFloat angleInRadians = degrees * (M_PI / 180);
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGRect imgRect = CGRectMake(0, 0, width, height);
CGAffineTransform transform = CGAffineTransformMakeRotation(angleInRadians);
CGRect rotatedRect = CGRectApplyAffineTransform(imgRect, transform);
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 — forked from jboner/latency.txt
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
You can’t perform that action at this time.