The above script will create an Express Router with routes that mirror the folder structure, with the
possibleAPIMethods file names being the verb handlers.
Example:
Given the folder structure
This document outlines how I use git in order to do development work. These are guidelines and not actual rules.
The first thing we need to do is get the remote repo to be local. We do that by cloning the repo. As an example,
if you wanted to do work on the beardedtim/my-little-nlp repo, you would run the following to clone it to a local
folder:
| const { Router } = require('express') | |
| const Step = new Router() | |
| Step.get('/starting_at/:id', async (req, res) => { | |
| const { rows } = await db.query(` | |
| SELECT * | |
| FROM nodes | |
| WHERE | |
| meta @> '{"starting_states": ["${req.params.id}"]}' | |
| `) |
| /* create some nodes to connect */ | |
| INSERT INTO nodes(title) VALUES | |
| ('Linux'), | |
| ('Operating System'); | |
| /* create a connection to connect nodes with */ | |
| INSERT INTO links(title) VALUES ('is_a'); | |
| /* And connect the two nodes created via the link */ | |
| INSERT INTO connections(node_a, link, node_b) VALUES |
Once you understand what monads are, and why they exist, you lose the ability to explain it to anybody.
Here's to hoping I don't understand them
| // comes with node | |
| const fs = require('fs') | |
| // need to install via `npm i ramda` or `yarn ramda` | |
| const R = require('ramda') | |
| // This is the closed dataset from Metabase | |
| // saved as a json file locally | |
| const closed = require('./data/closed.json') | |
| // Group By Points | |
| const byStoryPoints = R.groupBy(R.prop("story_points"), closed) |
| # | |
| # All work is based off this document | |
| # | |
| # http://snowball.tartarus.org/algorithms/porter/stemmer.html | |
| # | |
| # The first part of the algorithm talks about | |
| # what a constant is. So let's encode that in | |
| # python! | |
| # The following are _always_ considered |
| import React, { useEffect, useState } from 'react' | |
| import { render } from 'react-dom' | |
| import { interval } from 'rxjs' | |
| import { map } from 'rxjs/operators' | |
| const getPusher = () => interval(500).pipe( | |
| map(() => ({ message: 'New Pusher Message', time: new Date() })) | |
| ) | |
| const usePusher = () => { |
| axios.post('/uri', { | |
| title: 'Hello', | |
| world: 'world' | |
| }) | |
| const body = req.body | |
| const data = JSON.parse(body) | |
| console.log(data) // { title: 'Hello', world: 'world' } |
| import React, { Component } from 'react' | |
| class Form extends Component { | |
| constructor(props) { | |
| super(props) | |
| this.onSubmit = this.onSubmit.bind(this) | |
| this.onChange = this.onChange.bind(this) | |
| this.state = {} |