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
// Usage: node index.mjs YOUR_API_KEY | |
import fetch from "node-fetch"; | |
import fs from "fs"; | |
async function fetchRevueData(key) { | |
const response = await fetch("https://www.getrevue.co/api/v2/issues", { | |
headers: { | |
Authorization: `Token ${key}`, | |
}, |
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 yamlhead from "yamlhead"; | |
import marked from "marked"; | |
const path = require("path"); | |
const fs = require("fs"); | |
const directoryPath = path.join(__dirname, "../data"); | |
async function readDir() { | |
try { |
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 nlp = require('compromise'); | |
function elizaBot(input) { | |
const doc = nlp(input); | |
if (doc.has('i #Adverb? (am|feel) #Adverb? #Adjective')) { | |
const feeling = doc.match('i #Adverb? (am|feel) #Adverb? [#Adjective]').out('normal'); | |
return `When did you become ${feeling}?`; | |
} else if (doc.has('i live in #Place')) { | |
const place = doc.match('[#Place]'); |
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 chai = require('chai'); | |
var assert = chai.assert; | |
var expect = chai.expect; | |
var should = chai.should(); | |
var sinon = require('sinon'); | |
function myAsyncFunction(callback) { | |
// 50ms delay before callback | |
setTimeout(function() { | |
console.log('hello'); |
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 Layer = require('synaptic').Layer; | |
const Network = require('synaptic').Network; | |
const Trainer = require('synaptic').Trainer; | |
const inputLayer = new Layer(15); | |
const hiddenLayer = new Layer(40); | |
const outputLayer = new Layer(4); | |
inputLayer.project(hiddenLayer); | |
hiddenLayer.project(outputLayer); |
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
#!/bin/bash | |
# Check for .only() in this path | |
FOLDER="./webapp/src/js" | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object |
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 express = require('express') | |
const app = express() | |
const path = require('path') | |
const fetch = require('node-fetch') | |
const PORT = process.env.PORT || 3000 | |
app.get('/api/user', (req, res) => { | |
res.json({ name: 'Richard' }); | |
}); |
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 { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
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 fs = require('fs'); | |
const file = fs.readFileSync('./1.txt').toString('utf8'); | |
let level = 0; | |
let findWay = (char) => { | |
if (char === '(') return 1; | |
else if (char === ')') return -1; | |
} |
NewerOlder