This file contains hidden or 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
// Common pattern of wrapping a library async function in a promise | |
function retriesAsyncOperation (args, retriesLeft = 5) { | |
return new Promise((resolve, reject) => { | |
performAsyncOp(args) | |
.then(result => resolve(result) | |
.catch((error) => { | |
if (retriesLeft == 0) { | |
reject(error) | |
} else { | |
// Passing reject as second argument allows outermost promise to fail when retries run out |
This file contains hidden or 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
diff --git a/backend/package.json b/backend/package.json | |
index d0b2711..b731869 100644 | |
--- a/backend/package.json | |
+++ b/backend/package.json | |
@@ -16,6 +16,7 @@ | |
"author": "Vincent Ning", | |
"license": "ISC", | |
"dependencies": { | |
+ "cors": "^2.8.5", | |
"express": "^4.16.4", |
This file contains hidden or 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
$(document).ready(function(e){ | |
//commID = getCommunity(); | |
commID = "ACH"; | |
var campusArray = ilHeadshots.filter(function(item){ | |
return item.community == commID; | |
}); | |
console.log(ilHeadshots); | |
console.log(""); | |
console.log(campusArray); |
This file contains hidden or 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"; | |
import axios from "axios"; | |
import Export from "./Export"; | |
import Login from "./Login"; | |
class App extends React.Component { | |
state = { | |
user: null | |
}; |
This file contains hidden or 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
// | |
// Cache the response of an axios request | |
// | |
const cacheRequest = request => { | |
let cache = null; | |
return () => { | |
cache = cache || request.then(({ data }) => data); | |
return cache; | |
}; |
This file contains hidden or 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 ordersEpic = (action$, state$) => action$.pipe( | |
// Listen for this action | |
ofType(type.GET_ORDERS), | |
// Replace the action with the list of active IDs | |
mapTo(state$.value.market.ids), | |
// Turn the list into a stream of ids | |
flatMap(from), |
This file contains hidden or 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 axios = require('axios'); | |
const endpoints = require('./endpoints'); | |
const knex = require('knex')({ | |
client: 'sqlite3', | |
connection: { | |
filename: "./sde.sqlite" | |
} | |
}); |
This file contains hidden or 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
diff --git a/hash-tables/ex1/ex1.py b/hash-tables/ex1/ex1.py | |
index 3039cf3..e7e289d 100644 | |
--- a/hash-tables/ex1/ex1.py | |
+++ b/hash-tables/ex1/ex1.py | |
@@ -1,14 +1,14 @@ | |
def get_indices_of_item_weights(weights, limit): | |
- hash_table = { i : weights[i] for i in range(0, len(weights) ) } | |
- hash_table2 = {y:x for x,y in hash_table.items()} | |
+ hash_table = { weights[i] : i for i in range(len(weights)) } |
This file contains hidden or 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
diff --git a/hash-tables/ex1/ex1.py b/hash-tables/ex1/ex1.py | |
index 3039cf3..e7e289d 100644 | |
--- a/hash-tables/ex1/ex1.py | |
+++ b/hash-tables/ex1/ex1.py | |
@@ -1,14 +1,14 @@ | |
def get_indices_of_item_weights(weights, limit): | |
- hash_table = { i : weights[i] for i in range(0, len(weights) ) } | |
- hash_table2 = {y:x for x,y in hash_table.items()} | |
+ hash_table = { weights[i] : i for i in range(len(weights)) } |
This file contains hidden or 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 typeDefs = ` | |
type Query { | |
hello: String | |
} | |
`; | |
const resolvers = { | |
Query: { | |
hello: () => "Hello, world!" | |
} |