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
| .CursorDragHorizontal { | |
| cursor: col-resize; | |
| } | |
| /* TKToggle */ | |
| .TKToggle { | |
| color: #46f; | |
| border-bottom: 1px dashed #46f; |
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
| ; some of this functions, specifically ones from the early chapters, aren't tested, | |
| ; as I schemed through them. | |
| ; atom? | |
| (define atom? | |
| (lambda (x) | |
| (and (not (pair? x)) (not (null? x))))) | |
| ; lat? | |
| (define lat? |
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
| # JSONP | |
| # Usage: jsonp 'http://google.com/', (data) -> console.log data | |
| # Adapted from https://github.com/msingleton/TinyP | |
| ( ($, d) -> | |
| $.jsonp = (url, callback) -> | |
| # Create a random function name | |
| text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz$_' | |
| c = (text[Math.floor(Math.random() * 54)] for i in [1..20]).join('') | |
| # Add the script |
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
| scala> 4 + "1.0" | |
| res12: String = 41.0 | |
| scala> "1.0" + 4 | |
| res13: java.lang.String = 1.04 |
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
| class Zero | |
| @create: -> | |
| class OrpheusInner extends @ | |
| attributes: [] | |
| attr: (x) -> @attributes.push x | |
| return new OrpheusInner() | |
| class One extends Zero | |
| constructor: -> | |
| @attr 'bloob' |
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
| # Thank you ZapaaJS! | |
| # congrats to require() for making nodejs so awful | |
| # for dividing code to files. | |
| include = (file, args...) -> | |
| file = require file | |
| file.include.apply(this, args) | |
| file | |
| # index.coffee |
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
| async = require 'async' | |
| # Async needs some coffee script suger | |
| ### | |
| Parallel | |
| --------------------------------------------------- | |
| // an example using an object instead of an array | |
| async.parallel({ | |
| one: function(callback){ |
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
| does = from = (arr, using) -> | |
| for i in arr when using[0] i | |
| return using[1] i | |
| return using[2] | |
| get = (obj) -> | |
| for key,val of obj | |
| return [ | |
| (i) -> i[key] is val | |
| (i) -> i |
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
| @logs = [] | |
| for msg_type, log_level in ['error', 'warn', 'info', 'debug'] | |
| do (msg_type, log_level) -> | |
| @[msg_type] = (msg = '', data = {}) -> | |
| # Add to logs | |
| @logs.push | |
| type: msg_type | |
| msg: msg |
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
| getQuantity: (item_id) -> (i.quantity for i in items when i.id is item_id)[0] | |
| # Or: | |
| getQuantity: (item_id) -> | |
| for i in @items | |
| return i.quantity if i.item_id is item_id | |
| undefined |