I built Modify.sg
I work at Grab, built NUSMods and founded NUSWhispers.
Modify was built with VueJS
Easy to learn
-
{{ todo.text }}
Don't just take my word
It is fast.
It's getting increasingly popular
Crawling with Scrapy I thought this was a Javascript talk?
NTU load their data in an iframe.
Community
Easy to parse via selectors
AC2103
RISK MANAGEMENT, CONTROL AND ETHICS
4.0
ACC
Prerequisite:
AC2101(Corequisite) & AC2401(Corequisite) & AC3101
Mutually exclusive with:
AA205, AC3104
No well defined layers
Select using color tags
Select using   that was in between each module somehow
Naming is one of the hardest things in Computer Science.
Nimble but stable
v2.0 | v3.0 | |
---|---|---|
Bundler | Grunt + Browserify | Webpack |
Language | ES5 | ES6 / Babel By Facebook |
Package Manager | NPM | Yarn By Facebook |
JS Framework | Backbone + Marionette | React + Redux By Facebook |
Type | N/A | Flow By Facebook |
Tests | N/A | Jest By Facebook |
render(data) -> view
reducer(state, action) -> nextState
function addModule(moduleCode, lessons) {
return {
type: 'ADD_MODULE',
payload: {
moduleCode: moduleCode,
lessons: lessons
}
};
}
function timetable(state, action) {
switch (action.type) {
case 'ADD_MODULE':
var newState = Object.assign({}, state);
newState.modules.push(action.payload.moduleCode);
newState.lessons.push(action.payload.lessons);
return newState;
default:
return state;
}
}
Fire same action from different places.
// @flow
function foo(x) {
return x * 10;
}
foo('Hello, world!');
type Module = {
AcadYear: string,
CorsBiddingStats: Array<BiddingStat>,
Department: string,
ModuleCode: string,
ModuleCredit: string,
ModuleDescription: string,
ModuleTitle: string,
Preclusion?: string,
Prerequisite?: string,
Types: Array<string>,
Workload?: string
};
type Lesson = {
ClassNo: string,
DayText: string,
EndTime: string,
LessonType: string,
ModuleCode: string,
StartTime: string,
Venue: string,
WeekText: string
};
Develop for the phone first, using Chrome/Firefox's mobile debugger
Use media queries intensively
Drag n Drop too unintuitive
Clicking is easier, faster and less technically challenging
All substrings are included, module codes' ranking come after descriptions
Smarter rankings, less typing!
Better experience for people
Especially important for mobile devices
No access to DOM but can intercept requests
Does much much more, but...
We realised lessons that start at 6am exists
So did lessons that ended at midnight
So which hours do we present?
Plot out all lessons' start and end time for this semester
~90% of lessons lie between 10am and 7pm
Perhaps this is why the buses are so packed?
Problem arised when:
NTU people complained about horizontal mode.
NUS people complained about vertical mode.
Solution: Toggle-able orientations
A tale of tables, boxes and blocks
Too difficult to work with. Tables are not responsive.
Flexible, but difficult to master.
Also, many cross browser bugs. Curse you safari !
You see where this is going
If only...
Different variations / rewrites
Finally getting close
Good browser support but has to depend on javascript for flexibility
CSS Grids: the future?
Series of data transformations
type Lesson = {
ClassNo: string,
DayText: string,
EndTime: string,
LessonType: string,
ModuleCode: string,
StartTime: string,
Venue: string,
WeekText: string
};
Starts with an array of Lesson
s
// from
[LessonA, LessonB, LessonC, LessonD, ...];
// into
{
Monday: [LessonA, LessonB, LessonC],
Tuesday: [LessonD, ...]
};
// from
{
Monday: [LessonA, LessonB, LessonC],
Tuesday: [LessonD, ...]
};
// into
{
Monday: [
[LessonA, LessonB],
[LessonC],
],
Tuesday: [
[LessonD, ...]
],
...
};
Generic useful timetable representation
Detailed explanation found here
https://github.com/nusmodifications/nusmoderator
Utlity toolbelt for nus applications
JavaScript fatigue is real and it's here to stay.
Learn to embrace it.
Soon: ES7 GraphQL Backend Starter