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 createSelector = (state, props) => { | |
return (inputSelectors, transformFn) => { | |
const applySelectors = inputSelectors.map(selector => selector(state, props); | |
return transformFn(...applySelectors); | |
}; | |
}; |
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
'use strict'; | |
var disconnectClient = true; | |
var http = require('http'); | |
var Primus = require('primus'); | |
var primusServer; | |
var httpServer; | |
(function createServer() { | |
httpServer = http.createServer(); |
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 util = require('util'); | |
console.log(util.inspect(myObject, { showHidden: false, depth: null })); | |
// alternative shortcut | |
console.log(util.inspect(myObject, false, null, true)); |
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 express from 'express'; | |
const routes = express.Router(); | |
routes.get('/ok', (req, res, next) => { | |
res.data = { | |
result: 'ok' | |
}; | |
next(); |
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, { Component } from "react"; | |
import ReactDOM from "react-dom"; | |
import "./styles.css"; | |
class App extends Component { | |
state = { | |
selected: false | |
}; |
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 express from 'express'; | |
import routes from './routes'; | |
const app = express(); | |
app.use('/', routes); | |
app.use((req, res) => { | |
res.status(200).send(res.data); |
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 http = require('http'); | |
const inspect = require('util').inspect; | |
const Busboy = require('busboy'); | |
http.createServer(function(req, res) { | |
const busboy = new Busboy({ | |
headers: req.headers | |
}); |
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
var http = require('http'); | |
var fs = require('fs'); | |
var Busboy = require('busboy'); | |
http.createServer(function(req, res) { | |
var busboy = new Busboy({ | |
headers: req.headers | |
}); |
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 buildMap = (bombPositions) => { | |
let positions = Array.from({length: 10}, (value, x) => { | |
return Array.from({length: 10}, (value, y) => { | |
return { | |
position: {x, y}, | |
value: (isPositionBomb(bombPositions, {x, y}) | |
? 'B' | |
: getNeighborBombPositions(bombPositions, {x, y}).length | |
), | |
visibility: 'hidden' // visible, marked |
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
console.log('Program Start'); | |
var async = require('async'); | |
async.waterfall([ | |
function (callback) { | |
console.log('First Step --> '); | |
callback(null, '1', '2'); | |
}, | |
function (arg1, arg2, callback) { | |
console.log('Second Step --> ' + arg1 + ' ' + arg2); |
NewerOlder