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
| paul = new | |
| @name = 'paul' | |
| @age = 25 | |
| # LiveScript has real object comprehensions | |
| flip = (obj) -> new | |
| for own k, v of obj then @[v] = k |
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 = 'key' | |
| bar = {(foo): 5, "dyna#foo": 6} #=> {'key': 5, 'dynakey': 6} | |
| # in destructuring | |
| {(+* .>>. 1): middle} = [1 to 7] # middle = 4 |
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
| {username ? 'root', password || '', secure && 'https' | |
| || 'http'} = config<[ USERNAME PASSWORD SECURE ]> |
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 Person | |
| # defaults @name to [], and assigns the first element | |
| set-first-name: (@[]names.0) -> | |
| # defaults @name to [], and adds the element (* being the array's length) | |
| add-name: (@[]names[*]) -> | |
| # defaults @hair to {}, and assigns color | |
| set-hair-color: (@{}hair.color) -> |
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
| posts['op' ...'replies'] = thread | |
| # even with objects | |
| extended = {...base, +extended} |
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
| # basic backpipe usage | |
| toCase \up <| \hello | |
| # let's say that, if we have no page, we need to create an un element | |
| # with a li element containing 1 | |
| pages.appendChild <| do | |
| node 'ul' className: 'ui-pagination' | |
| ..appendChild node 'li' innerHTML: '1' |
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
| td = node 'td' class: 'informations' innerHTML: do | |
| i18n.get-translation 'informations' .format-for @user | |
| # use do and backcall | |
| promises = | |
| value: do |
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
| var App = React.createClass({ | |
| getInitialState: function () { | |
| return { | |
| name: 'I\'m Kevin, click me to change my name' | |
| } | |
| }, | |
| handleClick: function () { | |
| this.setState({ | |
| name: 'Peter is here now!' | |
| }) |
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
| var App = React.createClass({ | |
| getInitialState: function () { | |
| return { | |
| checked: false | |
| } | |
| }, | |
| handleCallbackCheck: function (checked) { | |
| this.setState({ | |
| checked: checked | |
| }) |
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
| import revue from './revue' | |
| Vue.use(revue, { | |
| store: require('./store') | |
| }) |