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
/* | |
Copyright 2011 Martin Hawksey | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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
<html> | |
<form> | |
</form> | |
<script> | |
/* | |
on form submit -> post to index2.js -> console.log(result from index2.js) | |
*/ | |
</script> |
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
require('dotenv').config() | |
var express = require('express') | |
, app = express() | |
, bodyParser = require('body-parser') | |
, fetch = require('node-fetch') | |
, cookieParser = require('cookie-parser') | |
, Promise = require('bluebird') | |
const {URLSearchParams} = require('url'); | |
app.use(cookieParser()) |
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
<!doctype html> | |
<html> | |
<head> | |
<script src="/js/vue.js"></script> | |
</head> | |
<body> | |
<div id="mycontainer"> | |
<input id="search" type="Submit" value="Search for nearby restaurants" @click="search" /> | |
<div id="err"></div> | |
<table> |
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
require('dotenv').config() | |
var ldap = require('ldapjs') | |
, Promise = require('bluebird') | |
process.env.NOD_TLS_REJECT_UNAUTHORIZED = "0"; | |
var client = ldap.createClient({ | |
url: process.env.ldaphost | |
}); |
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
require('dotenv').config() | |
var ldap = require('ldapjs') | |
, Promise = require('bluebird') | |
, express = require('express') | |
, app = express() | |
//process.env.NOD_TLS_REJECT_UNAUTHORIZED = "0"; | |
var ldapClient = ldap.createClient({ | |
url: process.env.ldaphost |
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
app.get('/conflictMatrix', (req, res) => { | |
var token = Promise.try(() => { | |
return tokenPromise() | |
}) | |
var courses = knex('offered_courses').select('*').where('NumSections','<',3).andWhere('Offered', 1).map((row) => { | |
row.conflicts = {}; | |
return row | |
}).then(rows => rows); | |
Promise.all([courses, token]).then((values) => { |
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
Promise.try(() => { | |
return Promise.all([ | |
knex('course_requests').select('*'), | |
knex('course_requests').distinct('CourseTitle').select().groupBy('CourseTitle') | |
]) | |
}).then(([allrecords, rows]) => { | |
var obj = rows; | |
/* I'm trying to take each of the data and insert the object of itself: something like this | |
Turning [A,B,C,D,E] into => [A: {A,B,C,D,E}, B:{A,B,C,D,E}, C:{A,B,C,D,E}, etc...you get the point..] |
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
Promise.try(() => { | |
return Promise.all([ | |
knex('course_requests').select('*'), | |
knex.raw('select distinct(CourseTitle) as courses from course_requests group by CourseTitle') | |
]) | |
}).then(([allrecords, rows]) => { | |
console.log(rows) | |
}) | |
/* Console.log(rows) |
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
Promise.try(() => { | |
return Promise.all([ | |
knex('course_requests').select('*'), | |
knex('course_requests').distinct('CourseTitle').select().groupBy('CourseTitle') | |
]) | |
}).then(([allrecords, rows]) => { | |
/* | |
if rows: [ | |
A: { | |
foo:bar, |
OlderNewer