Skip to content

Instantly share code, notes, and snippets.

View yulingtianxia's full-sized avatar
🍣
Eating

杨萧玉 yulingtianxia

🍣
Eating
View GitHub Profile
@yulingtianxia
yulingtianxia / Graph.h
Last active August 29, 2015 14:00
用DFS算法计算SpriteKit中复合体的构成
//
// Graph.h
// ColorAtom
//
// Created by 杨萧玉 on 14-4-21.
// Copyright (c) 2014年 杨萧玉. All rights reserved.
//
#import <Foundation/Foundation.h>
@import SpriteKit;
@yulingtianxia
yulingtianxia / Credit.h
Last active August 29, 2015 14:01
一个可以显示数字的类,可以根据数字大小自动控制字号,并在数字变化时建立插值,产生指数渐变效果
#import <UIKit/UIKit.h>
@interface Credit : UILabel
-(void)autochangeFontsize:(double) number;
-(void)changeFromNumber:(double) originalnumber toNumber:(double) newnumber withAnimationTime:(NSTimeInterval)timeSpan;
@end
@yulingtianxia
yulingtianxia / pptp.sh
Last active August 29, 2015 14:02
VPN pptp 脚本
#!/bin/sh
if [ `id -u` -ne 0 ]
then
echo "please run it by root"
exit 0
fi
apt-get -y update
apt-get -y install pptpd || {
@yulingtianxia
yulingtianxia / LRUCache.swift
Created November 27, 2016 17:29
Swift LRUCache
class CacheGenerator<T:Hashable> : IteratorProtocol {
typealias Element = T
var counter: Int
let array:[T]
init(keys:[T]) {
counter = 0
array = keys
@yulingtianxia
yulingtianxia / ConvertInvocationArguments.m
Created October 27, 2017 03:44
Convert NSInvocation and NSArray containing arguments. Under Developing!
NSString *MTExtractStructName(NSString *typeEncodeString)
{
NSArray *array = [typeEncodeString componentsSeparatedByString:@"="];
NSString *typeString = array[0];
int firstValidIndex = 0;
for (int i = 0; i< typeString.length; i++) {
char c = [typeString characterAtIndex:i];
if (c == '{' || c=='_') {
firstValidIndex++;
}else {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.