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
| { | |
| "author": "robert kuzelj <robert@capitalize.org>", | |
| "name": "capitalize", | |
| "description": "capitalizes and decapitalizes a string", | |
| "version": "0.3.0", | |
| "homepage": "www.capitalize.org", | |
| "repository": | |
| { | |
| "url": "" | |
| }, |
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
| { | |
| ... | |
| "version": "0.3.0", | |
| ... | |
| "bin" : | |
| { | |
| "cap" : "./bin/cap.js", | |
| "ccap": "./bin/ccap.js", | |
| "dcap": "./bin/dcap.js" | |
| } |
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
| { | |
| ... | |
| "version": "0.4.0", | |
| ... | |
| "bin" : | |
| { | |
| "cap" : "./bin/cap.js", | |
| "ccap": "./bin/ccap.js", | |
| "dcap": "./bin/dcap.js", | |
| "coffee": "./bin/dcap.js" |
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
| get = "get" | |
| set = (value) -> value | |
| class Grid | |
| @new: (x, y, val = 0)-> | |
| item = new Grid x, y, val | |
| (x, y) -> | |
| (value) -> | |
| if value == get | |
| return item.grid[x][y] |
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 Grid | |
| @new: (x, y = 1, dval = 0)-> | |
| item = new Grid x, y, dval | |
| (x, y) -> | |
| (value) -> | |
| v = value() | |
| if v is undefined | |
| return item.grid[x][y] | |
| else | |
| item.grid[x][y] = v |
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
| # very simple, very clear. If need to be changed, changes in two places | |
| func: (data)=> | |
| if data.x % @TILE_SIZE == 0 | |
| @x = Math.floor(data.x / @TILE_SIZE) | |
| if data.y % @TILE_SIZE == 0 | |
| @y = Math.floor(data.y / @TILE_SIZE) | |
| # easier to change BUT intention not so clear anymore | |
| # and also longer and took longer to write | |
| func: (data)=> |
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
| foo = (param1)-> | |
| (param2)-> | |
| param1 + param2 | |
| foo(1)(2) |
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 A | |
| class B | |
| # packages and their artifacts must be defined as object literals | |
| window.foobaz = { | |
| A | |
| 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
| #take care I am using requirejs for modules | |
| define [], -> | |
| Enum = (enumeration)-> | |
| check = (value)-> | |
| newval = null | |
| for key, val of enumeration | |
| if val == value | |
| newval = value | |
| break |
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
| macro lock { | |
| case ($x) $block => { | |
| locking($x, function); | |
| } | |
| } | |
| lock ("A") { | |
| console.log("foo"); | |
| }; |