add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
const travisRepos = { | |
'1995928': {name: "tp-yarra", slug: 'codeworksbcn/tp-yarra'}, | |
'2208412': {name: "tp-paint-fill", slug: 'codeworksbcn/tp-paint-fill'}, | |
} | |
const firebaseRepos = { | |
'1995928': {active: false, name: "tp-yarra", time: 60}, | |
'2208412': {active: false, name: "tp-paint-fill", time: 60}, | |
'1983769': {active: false, name: "tp-two-adds", time: 60}, | |
'2451579': {active: false, name: "tp-diamond", time: 60}, | |
'2451589': {active: false, name: "tp-evented-thing", time: 60}, |
const pokemonIds = [1,2,3] | |
const pokemons = pokemonIds.map(id => { | |
return fetch(`https://pokeapi.co/api/v2/pokemon/${id}`) | |
.then(res => res.json()) | |
.then(json => { | |
console.log(json) | |
return json | |
}) | |
}) |
const someEven = [1,2,3,4,5] | |
const allEven = [2,4,6,8,10] | |
const isEven = (n) => { | |
if (n % 2 ===0) return true | |
return false | |
} | |
const every = (collection, predicate, context) => { | |
if (Array.isArray(collection)) { |
const allEven = [2,4,6,8,10] | |
const isEven = (el) => { | |
if (el % 2 === 0) return true | |
return false | |
} | |
const _each = function (collection, iteratee, context) { | |
if (Array.isArray(collection)) { | |
for (let [i, el] of collection.entries()) { | |
iteratee.call(context, el, i, collection) |
{ | |
"name": "unit-testing", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "mocha './tests/*.test.js'" | |
}, | |
"author": "", | |
"license": "ISC", |
function factorial (n) { | |
let product = 1 | |
for (let i=n; i>0; i--) { | |
product = product * i | |
} | |
return product | |
} | |
console.log(factorial(5)) |
add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
//excercise to promisify a function | |
const readFilePromise = promisify(fs.readFile); | |
const writeFilePromise = promisify(fs.writeFile); | |
readFilePromise(url) | |
.then(data => {}) | |
.catch(e => {}) |
Guide to getting started with Knex and Postgres
First, get up and running with Postgres I referenced this other gist for this guide, Setting up Express with Knex
Next, write up a minimal app that connects Knex to Postgres.
//terminal
$ mkdir knex-test