Skip to content

Instantly share code, notes, and snippets.

Viswesh Subramanian viswesh

Block or report user

Report or block viswesh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@viswesh
viswesh / manifest.json
Created Sep 24, 2017
Web App Manifest sample file.
View manifest.json
{
"name": "JavaScript Store",
"short_name": "JavaScript Store",
"lang": "en-US",
"start_url": "/",
"display": "fullscreen",
"orientation": "portrait",
"theme_color": "#f2e058",
"icons": [
{
@viswesh
viswesh / proxyandreflect.js
Created Sep 21, 2017
Sample code for demonstrating Proxy and Reflect usage.
View proxyandreflect.js
function propDefaults(defaults) {
const handler = {
get (obj, prop) {
return Reflect.get(obj, prop) || defaults[prop];
}
};
return new Proxy({}, handler);
}
const palette = propDefaults({color: "yellow"});
@viswesh
viswesh / jspromisses.js
Last active Mar 4, 2018
JavaScript promise sample
View jspromisses.js
let promise = new Promise((resolve, reject) => {
//invoke async operation, then
if (/* success */) {
resolve("response received! Success!");
} else {
reject(Error("Something failed"));
}
});
promise.then(function(result) {
View es6templatestrings.js
displayFeatures() {
  this._features.forEach((feature, index) => console.info(`${this._language} feature ${index} ${feature}`))
}
@viswesh
viswesh / es6iterators.js
Created Sep 11, 2017
ES6 Iterators sample
View es6iterators.js
let s = “Hello”;
let sIterator =  s[Symbol.iterator]();
console.info( sIterator.next().value ) //H
console.info( sIterator.next().value ) //e
console.info( sIterator.next().value ) //l
@viswesh
viswesh / es6arrows.js
Last active Sep 11, 2017
ES6 Arrow sample
View es6arrows.js
var store = {
  _language: “JavaScript”,
   _features: [],
   displayFeatures() {
     this._features.forEach((feature, index) =>console.info(this._language + feature + index+ “ ”+ feature))
   }
}
View es6class.js
class Person { //instance method
speak() {
console.log(‘speak’);
}
}
class Person { //static method
static isHuman() {}
}
class Person { //initialize instances
constructor(arguments) {}
You can’t perform that action at this time.