Hello World! My solutions to the contest are posted here!
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 { h, Component } from 'preact'; | |
class AsyncComponent extends Component { | |
constructor() { | |
super(); | |
this.state = { loading: true }; | |
this.getAsyncState = this.getAsyncState.bind(this); | |
this.update = this.update.bind(this); | |
} |
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 { h, Component } from 'preact'; | |
/** | |
* <SplitPoint load={require('bundle?lazy!./foo')} fallbackContent={( | |
* <div class="loading" /> | |
* )} /> | |
*/ | |
class SplitPoint extends Component { | |
componentWillMount() { | |
let cb = this.linkState('child'), |
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
function translate(sentence) { | |
const vowels = 'aeiou'.split(''); | |
const isUpper = (char => char === char.toUpperCase()); | |
const pigLatin = ((str, i = 0) => { | |
if (vowels.includes(str[0])) { | |
return i === 0 ? str + 'way' : str + 'ay'; | |
} | |
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
{ | |
"name": "express-without-eject", | |
"version": "0.1.0", | |
"private": true, | |
"devDependencies": { | |
"react-scripts": "0.7.0" | |
}, | |
"dependencies": { | |
"express": "^4.14.0", | |
"react": "^15.3.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
const express = require('express'); | |
const PORT = process.env.PORT || 3000; | |
// Initialize express | |
const app = express(); | |
// Serve the build file | |
app.use('/', express.static(process.cwd() + '/build')); |
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
// Grab dependencies | |
const express = require('express'); | |
const chalk = require('chalk'); // Chalk was added by create-react-app, use only on the dev side | |
const webpack = require('webpack'); | |
const webpackDevServer = require('webpack-dev-server'); | |
// load up our environment variables | |
require('dotenv').load(); | |
const PORT = process.env.PORT || 3000; |
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
{ | |
"name": "express-without-eject", | |
"version": "0.1.0", | |
"private": true, | |
"devDependencies": { | |
"react-scripts": "0.7.0" | |
}, | |
"dependencies": { | |
"express": "^4.14.0" | |
}, |
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
const express = require('express'); | |
// Chalk was added by create-react-app, use only on the dev side | |
const chalk = require('chalk'); | |
// Initialize express | |
const app = express(); | |
const PORT = process.env.PORT || 3000; | |
// Start up our express server | |
app.listen(PORT, (error) => { |