This file contains 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
const reducers = { | |
add(state, {payload: [number]}) { | |
return state + number; | |
}, | |
}; | |
function reducer(state, action) { | |
if (reducers.hasOwnProperty(action.type)) | |
return reducers[action.type](state, action); | |
return state; |
This file contains 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
def emit_point(): | |
print "x", x, "y", y | |
while width > 0 and height > 0: | |
direction = 1 | |
while direction >= -1: | |
for i in range(width - 1): | |
emit_point() | |
x += direction | |
for i in range(height - 1): |
This file contains 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
const app = { | |
logo: new Image; | |
}; | |
app.logo.onLoad = () => { | |
// do some stuff | |
} | |
app.logo.src = logoUrl; | |
This file contains 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 Application { | |
constructor(logoUrl, onLoad) { | |
this.logo = new Image; | |
this.logo.src = logoUrl; | |
this.callback = onLoad; | |
this.logo.onLoad = this.run.bind(this); | |
} | |
run() { | |
// some other things | |
this.callback(); |
This file contains 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
//License CC0 1.0: https://creativecommons.org/publicdomain/zero/1.0/ | |
class Deferred extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
value: '' | |
}; | |
} | |
componentDidMount() { |
This file contains 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
{ | |
"name": "Bułka z masłem", | |
"price": 10, | |
"currency": "PLN", | |
"description": "Bardzo smaczna" | |
} |
This file contains 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 React from 'react'; | |
import * as ReactDOM from 'react-dom'; | |
var root = { | |
name: 'World', | |
children: [ | |
{name: 'Sun', id:1}, | |
{ | |
name: 'Earth', id:2, |
This file contains 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 React from 'react'; | |
import * as ReactDOM from 'react-dom'; | |
var root = { | |
name: 'World', | |
children: [ | |
{name: 'Sun', id:1}, | |
{ | |
name: 'Earth', id:2, |
This file contains 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 foo() { | |
return <div>{'{ss'}</div>; | |
} | |
console.log(1); |
This file contains 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
const speck = require('speckjs'); | |
const fs = require('fs'); | |
const name = './src/index.js'; | |
speck.build({name: name, content: fs.readFileSync(name, 'utf8')}, {ecmaVersion: 6, sourceType: 'module'}); |