Skip to content

Instantly share code, notes, and snippets.

`
OBJECT LITERALS TO MAKE INSTANCES
`
// this is a model of real world object, a dog
const fido = {
name: 'Fido',
breed: 'Rottweiler',
age: 3,
/*
named functions inside objects are called methods
*/
function returnAnObject(name, age) {
const myObject = {
myName: name,
myAge: age,
sleep: function() {
console.log('zzzzz')
function myFunction (age, name) {
arguments[0]
console.log(`my name is ${name} and my age ${age}`)
}
`
"function" is the keyword that tells JS that we are about
/*
For loop for iteration
without an array
*/
for (let i=0; i<10; i++) {
console.log(i)
}
// 0

COURSE ROUTES

verb route body
GET courses
GET courses/:course_id
CREATE courses { name }
CREATE courses/:course_id/next-version
UPDATE courses/:course_id { name, status }
UPDATE courses/:course_id/move { new_index }
// E X A M P L E 1 (backend specific)
// Objection chaining, using promises
const getDog = (id) => Dog.query()
.findById(id)
const getDog = (id) => {
return Dog.query()

scaffold function

scaffold should be a function that takes in two inputs:

  • topicHierarchy
  • scaffoldSpec

Inputs

topicHierarchy

const materials = [
'course_work',
'course_work',
'exam',
'project',
'course_work'
]

Client Branches

branch description prune
master no
backup-new-course-panel No idea why we are saving this. yes
demo-multi-part-form-modal Demonstrates usage of custom MultiPart component along with Semantic Forms and Modals. Is somewhat outdated. no
demo-react-d3-tree Demonstrates basic usage of react-d3-tree package and nesting React components within it. no

Server Branches

branch description prune
master no
backup-dev-materials Backup of original schema code for materials. no
demo-singletable Demonstrates concrete table inheritance, specifically parent having one and only one of a concrete class instance. no
demo-singletable-mod Demonstrates class table inheritance. no