Skip to content

Instantly share code, notes, and snippets.

View shanecav's full-sized avatar
💽
Eating or thinking about eating

Shane Cavaliere shanecav

💽
Eating or thinking about eating
View GitHub Profile
@shanecav
shanecav / server.js
Created July 19, 2016 02:43
Flowtype error on node http Server listen method
const createServer = require('http').createServer
const app = require('./http/app') // Express app
const server = createServer(app)
server.listen(port)
/**
* ^ This is where I'm getting the Flow error:
*
* call of method `listen`: /Users/shane/projects/blockpop/server/src/server.js:22
@shanecav
shanecav / flatten.js
Created September 30, 2016 10:28
A function that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers
// recursively flatten arbitrarily nested array(s) of integers
const flatten = (arr) => {
// Reduce nested array(s) into a flat array (starting with empty array)
return arr.reduce((prev, cur) => {
if (Array.isArray(cur)) {
// if it's an array, concat its flattened result
return prev.concat(flatten(cur))
}
if (Number.isInteger(cur)) {
// if it's an integer, concat the value
@shanecav
shanecav / cloudSettings
Last active April 11, 2022 18:15
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-04-11T18:15:52.987Z","extensionVersion":"v3.4.3"}
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
#
# General
#