This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fl.outputPanel.clear(); | |
| var trace = fl.trace; | |
| fl.showIdleMessage(false); | |
| var doc = fl.getDocumentDOM(); | |
| var tl = fl.getDocumentDOM().getTimeline(); | |
| var firstGuideLayer = null; | |
| function main() | |
| { | |
| var guideLayers = getGuideLayers(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Freeware. source [email protected] | |
| ADC pin: P1.0 | |
| PWM signal pin: P1.2 | |
| ADC signal is just a light sensor with a 1K resistor to 3.3V | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Freeware. source [email protected] | |
| ADC pin: P1.0 | |
| PWM signal pin: P1.2 | |
| ADC signal is just a light sensor with a 1K resistor to 3.3V | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Managers | |
| { | |
| import Animation.*; | |
| import DDW.Managers.StateManager; | |
| import DDW.Managers.StateObject; | |
| import Screens.*; | |
| import flash.display.Sprite; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Core | |
| { | |
| public class WordList | |
| { | |
| private static var _instance:WordList; | |
| public function WordList() | |
| { | |
| } | |
| public static function getInstance():WordList |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html> | |
| <script> | |
| // need to manually set re.lastIndex = 0; or this happens | |
| var s1 = "bc11bc22f"; | |
| var s2 = "bc33bc44g"; | |
| var re = /.*?(bc..)/g; | |
| var result1 = re.exec(s1);//bc11 | |
| var result2 = re.exec(s2);//bc44 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typealias Sig = (num:Int)->Int[] | |
| var wrap:Sig = {(num:Int) in return [num]} | |
| wrap(num:3) // [3] | |
| wrap(num:4) // [4] | |
| func numLog() -> Sig{ | |
| var log:Int[] = [] | |
| return { | |
| log += $0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // How do you get the keys from a dictionary? | |
| let array = [1,2,3] | |
| let dict = [1: "One", 2: "Two", 3: "Three"] | |
| // cast to get the keys in an array | |
| var keys = Array(dict.keys) | |
| keys == array // comapre arrays with == | |
| var values = Array(dict.values) // the same works for values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // How do you compare tuples for equality? | |
| var tupleA = (1, "one") | |
| var tupleB = (1, "one") | |
| // tup == tup2 // error: tuples can not be compared with ==, can not be used as hash key etc | |
| // If you need to test for object equality, a tuple is not suitable | |
| tupleA.0 == tupleB.0 && tupleA.1 == tupleB.1 // but you can do this | |
| // you can also use element names | |
| var tupleC = (a:1, b:"one") | |
| tupleA.0 == tupleC.a && tupleA.1 == tupleC.b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // How to you safely convert an AnyObject with a number value into a Double? | |
| let anyDouble:AnyObject = 6.41 | |
| if let xx = anyDouble as? NSNumber { | |
| println( Double(xx)) // prints 6.41 | |
| } | |
| // will throw an error if the conversion fails! | |
| let casted = Double(anyDouble as NSNumber) // 6.41 |