Skip to content

Instantly share code, notes, and snippets.

View tian-chaiyaporn's full-sized avatar

Chaiyaporn Chinotaikul tian-chaiyaporn

View GitHub Profile
@tian-chaiyaporn
tian-chaiyaporn / gist:9a9fb9f67faa6d1754ed9394a82a9629
Created June 7, 2017 17:05
Front-end Thinkful Unit3 Lesson5.5 user feedback and iteration
1. Needs button to stop loading data as the wait can get too long.
2. Map panning for every points can get disorientating, only pan the map once when user select an area, otherwise, keep it still
3. Marker size for percentage change too big for 5-10 years range, change marker's absolute size for those years to be smaller
4. The wait can be too long; this is a hard problem to solve as api limitation cannot be overcomed unless it is paid. Consider preloading some essential data and store it in database for future use.
5. More data range; again, api limitation prevents wider range of data, but maybe combining Qunadl data with a different data source can expand the potential
@tian-chaiyaporn
tian-chaiyaporn / Serverside Unit1 Lesson 1.7
Created May 26, 2017 11:28
Serverside Unit1 Lesson 1.7
Echo Endpoint Drill:
https://swamp-peace.glitch.me
with query:
https://swamp-peace.glitch.me/echo/foo?cats=dogs
Mad lib generator Drill:
https://decisive-bridge.glitch.me
with query:
https://decisive-bridge.glitch.me?adjective1=red&adjective2=spikey&adjective3=effective&adverb=rapidly&name=Joe&noun=bungee%20cord&place=Kansas
@tian-chaiyaporn
tian-chaiyaporn / user-flow.jpg
Last active May 16, 2017 02:02
User Flow for Capstone
Please see the attached photo. I accidentally skipped this step when I was designing the app, and already made the prototype for the app.
@tian-chaiyaporn
tian-chaiyaporn / gist:3dfd38cb6284d296ce478705f2b3ebe7
Created May 15, 2017 23:32
High Level Definition of App Idea
Idea:
An app where user can compare house prices in different regions across United States.
Users may use this information to quickly see where they might decide to move to, or to buy real estate for investment.
Mechanism:
Using an API from Quandl, house prices are fetched and dynamically displayed on a map from Google Map API.
The user may choose to display the data for the whole country or for a specific state.
If the user chooses to see the house prices for a specific state, an array of house prices for the neighborhoods in the state will be fetched and displayed
User may also select the price changes in percentage, the time frame (1 year, 3 year, 5 year, and 10 years), in addition to the state
https://jsbin.com/mexiwul/edit?html,js,output
https://jsbin.com/gorefag/edit?html,js,output
https://jsbin.com/purunav/edit?html,css,js,output
What is scope?
Ans: Scope refers to the level of code block in a code file. It usually is used to differentiate the global scope and local scope;
The global scope refers to the whole code file, while the local scopr refers to the code block within individual functions.
Why are global variables avoided?
Ans: Global variables are usually avoided to prevent unexpected mutations of global variables that can happen unintentionally in large projects.
Explain javascript 'strict mode'
Ans: Javascript strict mode prevents potenrially dangerous actions such as the creation of variables without the 'var' declaration.
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
}
function mostFrequentWord(text) {
// get words that have been sorted with spaces and non-alphabet characters removed
var words = getTokens(text);
var wordFrequencies = {};
// add word in words and initialize count starting from 1 to each word not in the wordFrequencies object. If the word already exists in object, then simply add to the count.
https://jsbin.com/gaqonu/edit?html,js,console
https://jsbin.com/godemok/edit?html,js,output
https://jsbin.com/fatitu/edit?html,js,output
https://jsbin.com/huzeca/edit?html,js,console
https://jsbin.com/vidirec/edit?html,js,console
https://jsbin.com/quxome/edit?html,js,console
https://jsbin.com/yaqegov/edit?html,js,console
https://jsbin.com/sisanuq/edit?html,js,console
https://jsbin.com/furolep/edit?html,js,console
https://jsbin.com/qutevo/edit?html,js,console,output
https://jsbin.com/lokebay/edit?html,js,console,output
https://jsbin.com/caxivis/edit?html,js,console,output