Skip to content

Instantly share code, notes, and snippets.

type Todo {
completed : bool
text : string
}
state Todos { number: Todo } {
completed < filter('completed')
uncompleted < intersect(completed)
add(data) {
store Tasks {
@tasks = []
@undone <- @tasks.filter(task => !task.done)
makeTask(task) { return { title: title, done: false } }
addTask() { @tasks.push(makeTask(task)) }
clear() { @tasks = @undone }
}
return (
<ListItem.item
key={key || index}
onTap={this.handleTap.bind(this)}
title={article.get('title')}
after={articleRight}
index={index}
noicon
{...props}>
{stats}
store Farm {
@animals = ['cow', 'chicken', 'turkey']
}
view Main {
@name = 'Horse'
setAnimal = animal => @name = animal
<h1>Select your favorite animal</h1>
if (t.isArrayExpression(node.right)) {
let staticProps = []
node.right.elements = node.right.elements.map(el => {
if (!t.isObjectExpression(el)) return el
let { statics, dynamics } = extractStatics(el)
if (statics.length) staticProps.push(statics)
if (dynamics.length) return t.objectExpression(dynamics)
else return null
view SayHi {
let size = 10
<h1>hello</h1>
<button onClick={() => size += 20}>up</button>
$h1 = { fontSize: size, color: 'blue' }
}
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/
@natew
natew / a.js
Created November 21, 2015 01:28
import / export
import fns from './a'
view One {
var a = fns.aa()
}
view Two {
var b = fns.bb()
}
module.exports = {
loaders:
[
{ test: /\.css$/, loaders: ['style', 'css'] },
{ test: /\.json$/, loader: "json" }
],
// resolveLoader: {
// root: '/Users/nw/flint/packages/runner'
// },
resolve: {