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
| // Creates a UIColor from a Hex string. | |
| func colorWithHexString (hex:String) -> UIColor { | |
| var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString | |
| if (cString.hasPrefix("#")) { | |
| cString = cString.substringFromIndex(1) | |
| } | |
| if (countElements(cString) != 6) { | |
| return UIColor.grayColor() |
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
| function termFreqMap(str) { | |
| var words = str.split(' '); | |
| var termFreq = {}; | |
| words.forEach(function(w) { | |
| termFreq[w] = (termFreq[w] || 0) + 1; | |
| }); | |
| return termFreq; | |
| } | |
| function addKeysToDict(map, dict) { |