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
# run this command as administrator in PowerShell | |
# this installs the 'Oh-My-Posh' module (https://github.com/pecigonzalo/Oh-My-Posh) | |
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/pecigonzalo/Oh-My-Posh/master/install.ps1')) |
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
#!/usr/bin/env node | |
let faker = require('faker'); | |
let Post = require('../models/post'); | |
// connect to MongoDB | |
require('mongoose').connect('mongodb://localhost/poster'); | |
// remove all data from the collection first | |
Post.remove({}) |
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
let mongoose = require('mongoose'); | |
let Post = mongoose.model('Post', { | |
text: String, | |
posted_at: Date, | |
likes_count: Number, | |
author: String | |
}); | |
module.exports = Post; |
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 from 'react'; | |
class Card extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
colors: ['blue-grey', 'red', 'brown' ] | |
} | |
} | |
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
function Token(type, value) { | |
this.type = type; | |
this.value = value; | |
} | |
function isComma(ch) { | |
return /,/.test(ch); | |
} | |
function isDigit(ch) { |
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
function ASTNode(token, leftChildNode, rightChildNode) { | |
this.token = token.value; | |
this.leftChildNode = leftChildNode; | |
this.rightChildNode = rightChildNode; | |
} | |
function parse(inp){ | |
var outStack=[]; | |
var opStack=[]; |
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
function parse(inp){ | |
var outQueue=[]; | |
var opStack=[]; | |
Array.prototype.peek = function() { | |
return this.slice(-1)[0]; | |
}; | |
var assoc = { | |
"^" : "right", |
NewerOlder