Skip to content

Instantly share code, notes, and snippets.

@wing-puah
wing-puah / Cat.js
Created March 14, 2020 15:23
Pub-sub code gist example
class Cat {
constructor(name, interests) {
this.name = name;
this.interests = interests;
this.unsubscribe = {};
}
addUnsubscription(keyName, method) {
this.unsubscribe[keyName] = method;
}
@wing-puah
wing-puah / proxy.js
Last active April 6, 2019 10:03
Proxy for API call to overwrite
const proxy = 'https://cors-anywhere.herokuapp.com/';
const CORSBlockedURL = 'https://www.some.block.url.com';
axios
.get(`${proxy}${CORSBlockedURL}`)
.then(res => {
console.log("res in axios", res);
});
@wing-puah
wing-puah / createIndex
Last active May 6, 2018 16:04
Automate start of a frontend development
createIndex() {
mkdir src
cd src
touch index.js
cd .. # go back to root folder
touch index.html
}
@wing-puah
wing-puah / add-basic-comparison
Last active February 15, 2018 13:03
Define condition of person finding Match and define match
function greaterThan( value, other ){
if( value > other ){
return 1;
} else {
return 0;
}
}
function matchTheMatch(el) {
if(el > 50 ){