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
/** | |
* << README >> | |
* Github Issue: https://github.com/sachinraja/trpc-playground/issues/55 | |
* | |
* This file is a workaround for fixing issues with the schema generation for the trpc-playground package | |
* with the V11 tRPC release. This file fixes an issue where the typescript types for the router are not resolved correctly | |
* | |
* This is due to the fact that the trpc package made some breaking changes to the router type | |
* Issues this file fixes: | |
* - _def.query and _def.mutation are now replaced by a _def.type field which can be 'query' | 'mutation' | 'subscription' |
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 { Client } = require('pg'); | |
const { pg } = require('../../config'); | |
module.exports = { | |
getAll: async (table) => { | |
try { | |
const db = new Client(pg); | |
await db.connect(); | |
const query = `SELECT * FROM ${table}`; | |
const results = await db.query(query); |
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
~ 200 RPS for with intial load balancer setup | |
Started phase 28, duration: 5s @ 22:27:22(+0000) 2019-03-14 | |
Report @ 22:27:27(+0000) 2019-03-14 | |
Elapsed time: 2 minutes, 40 seconds | |
Scenarios launched: 1874 | |
Scenarios completed: 1360 | |
Requests completed: 1360 | |
RPS sent: 187.69 | |
Request latency: |
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
config: | |
target: 'http://localhost:8081' | |
processor: "./generateGraphQuery.js" | |
phases: | |
- duration: 20 | |
arrivalRate: 20 | |
- duration: 5 | |
arrivalRate: 50 | |
- duration: 5 | |
arrivalRate: 55 |
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
config: | |
target: 'http://localhost:8081' | |
processor: "./generateGraphQuery.js" | |
phases: | |
- duration: 20 | |
arrivalRate: 20 | |
- duration: 5 | |
arrivalRate: 50 | |
- duration: 5 | |
arrivalRate: 55 |
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
## MySQL Read Queries | |
-- SELECT * FROM Songs as s | |
-- WHERE id = 10000000; | |
~ .1 ms | |
## MySQL Queries for related songs | |
-- SELECT * FROM Songs as s | |
-- LEFT JOIN Song_to_songs as sts |
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
// server.js | |
... | |
app.use('/api/products', productRoutes); | |
... | |
// controller/productRoutes.js | |
const express = require('express'); | |
const Products = require('../models/products'); |
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
class CashAmount{ | |
constructor(cashDecimalValue) { | |
this.cashDecimalValue = cashDecimalValue; | |
this.totalInPennies = this.totalInPennies.bind(this); | |
this.addDoubleAmount = this.addDoubleAmount.bind(this); | |
this.toDouble = this.toDouble.bind(this); | |
this.toDoubleString = this.toDoubleString.bind(this); | |
this.quantityOfEachDenomination = this.quantityOfEachDenomination.bind(this); |
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 findLargestLevel = function(node) { | |
// Search Breadth First | |
// Define queue | |
let queue = []; | |
// Enqueue first | |
let depth = 0; | |
queue.push({node, depth}); | |
// Track Depth Sums | |
let sumTracker = []; | |
while (queue.length > 0) { |