#Brokerage App - Requirements
- Your brokerage can have many clients
- A client can have many stocks
- Many clients can have the same stocks so you need to know everyone's holdings (e.g. Bob owns 15 Google Stocks but Joe owns 23 of them)
// Declare the async function | |
async function addInFourSeconds(x) { | |
// In 2 seconds, this Promise will be resolved with the value 10 | |
// Nothing else will be executed until these 2 seconds are over | |
var y = await resolveAfterTwoSeconds(10); | |
// print 10, since the above Promise has been resolved | |
console.log(y); | |
// In 2 seconds, this Promise will be resolved with the value 10 | |
// Nothing else will be executed until these 2 seconds are over | |
var z = await resolveAfterTwoSeconds(20); |
nick.newTab().then(async (tab) => { | |
await tab.open("news.ycombinator.com") | |
await tab.untilVisible("#hnmain") // We make sure we have loaded the page | |
await tab.inject("../injectables/jquery-3.0.0.min.js") // We're going to use jQuery to scrape | |
const hackerNewsLinks = await tab.evaluate((arg, callback) => { | |
const data = [] | |
$(".athing").each((index, element) => { | |
data.push({ | |
title: $(element).find(".storylink").text(), | |
url: $(element).find(".storylink").attr("href") |
// Phantombuster configuration { | |
"phantombuster command: casperjs" | |
"phantombuster package: 3" | |
"phantombuster transform: babel" | |
"phantombuster flags: save-folder" | |
import "babel-polyfill" | |
import Buster from "phantombuster" |
var text = 'hello'; | |
var url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key=trnsl.1.1.20150703T111847Z.50bb7b40984bcbfe.c87f5b960dc2613c413df68cdced5360645c6f81&lang=en-it&text="; | |
var translation; | |
function isCiao (text) { | |
console.log(text); | |
text === 'ciao' ? console.log('translation succesful') : console.log('translation FAIL'); | |
} |
#Brokerage App - Requirements
To practice everything we've learned over the last couple days, your task is to build a full blown Sinatra app from scratch. It should have full CRUD for a single model with a RESTful controller and corresponding views.
What can you make? You're welcome to be creative, but if you need some ideas:
Walkthrough - example of a todo app | |
w10/d2_todo_app | |
Note all along - Each time you write things on a new file, link it on the html with a script tag | |
Create our “seed data” with a few todos that we gather in a collection | |
On script.js (main js file) |