Skip to content

Instantly share code, notes, and snippets.

View lynxerzhang's full-sized avatar
🤒

frankwinter lynxerzhang

🤒
  • geckostudio
  • shanghai
View GitHub Profile
@lynxerzhang
lynxerzhang / SortDemo.swift
Created December 14, 2015 08:15
Jared Davidson's swift sort demo
//Jared Davidson's swift sort demo
//run in xcode 7.1 and swift 2.1
var ary = [0, 10, 8, 2]
ary = ary.sort({ $0 < $1 })
print(ary)
//[0, 2, 8, 10]
var strs = ["objectivec", "swift", "js", "as"]
strs.sortInPlace({$0 < $1})
print(strs)
@lynxerzhang
lynxerzhang / SwiftScreenMotionTips.swift
Created August 22, 2015 07:42
切换界面时自定义过度动画
//
// TransitionManager.swift
// SwiftScreenMotionTips
//
//@see http://mathewsanders.com/animated-transitions-in-swift/
import UIKit
import Darwin //contain pi's constant
class TransitionManager: NSObject, UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate {
@lynxerzhang
lynxerzhang / SwiftMotionPrototypeTips.swift
Last active August 29, 2015 14:27
swift动画练习
//
// ViewController.swift
// SwiftMotionPrototypeTips
//
// @see http://mathewsanders.com/prototyping-iOS-iPhone-iPad-animations-in-swift/
import UIKit
class ViewController: UIViewController {
@lynxerzhang
lynxerzhang / Trie.swift
Last active August 29, 2015 14:07
the trie data structure write in swift
import Foundation
"use xcode's playground"
/**
* port as3 to swift
* http://www.anotherearlymorning.com/2009/06/trie-data-structure-in-actionscript-3/
* http://www.emanueleferonato.com/2009/07/13/trie-data-structure-in-actionscript-3/
*
@lynxerzhang
lynxerzhang / GenerateEmbedClass.jsfl
Created May 25, 2014 08:36
将库中所有元件设置成导出状态(Export For ActionScript)
var doc = fl.getDocumentDOM();
//symbol type constant
var movieclipType = "movie clip";
var folderType = "folder";
var bitmapType = "bitmap";
var soundType = "sound";
//prefix
var mcPrefix = "ui";
#include <stdio.h>
#include <stdlib.h>
char* concatstr(char*, char*);
int strlen(char*);
int strend(char*, char*);
//K&R的c语言指针章节练习题
int main(void)
{
@lynxerzhang
lynxerzhang / ExportSwf.jsfl
Created February 27, 2014 12:26
export fla to swf (导出指定目录下的fla文件)
var doc = null;
var flaPath = null;
var outputPath = null;
var recursiveSearch = true;
var suffix = "fla";
run();
function run()
{
@lynxerzhang
lynxerzhang / FindMatchClassNameItem.jsfl
Last active August 29, 2015 13:56
find library asset by linkage class name (根据输入的链接类名寻找库中是否存在指定资源)
var doc = fl.getDocumentDOM();
var library = null;
var items = null;
var itemLen = null;
var item = null;
run();
function run()
{
@lynxerzhang
lynxerzhang / StageMatchContent.jsfl
Last active April 24, 2019 03:28
set Flash IDE's stage to match content's size(设置舞台的长宽以匹配舞台中放置的mc元件)
//@see http://keith-hair.net/blog/2010/03/21/resizing-flash-documents-to-fit-contents-in-jsfl/
//@see http://stackoverflow.com/questions/8056990/how-does-one-get-the-stroked-bounds-of-a-symbol-in-jsfl
var doc = fl.getDocumentDOM();
var timeline = doc.getTimeline();
var layer = null;
var frame = null;
var element = null;
run();
@lynxerzhang
lynxerzhang / ExecuteQueue.as
Last active August 29, 2015 13:56
ExecuteQueue in flash's Starling framework
package
{
import flash.utils.Dictionary;
import starling.animation.IAnimatable;
import starling.core.Starling;
/**
* 方法队列调用
*
* @example