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
<script> | |
let counter = 0; | |
const debounce = (fn, delay) => { | |
let timeoutId; | |
return () => { | |
clearTimeout(timeoutId); | |
timeoutId = setTimeout(fn, delay); | |
} |
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
// https://elijahmanor.com/cra-debug-vscode/ | |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Debug CRA Tests", | |
"type": "node", | |
"request": "launch", | |
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts", |
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
//step 1: Inside package.json add proxy key | |
// eg: "proxy": "http://jsonplaceholder.typicode.com" | |
//step 2: sample program to retrive from jsonplaceholder | |
(async()=>{ | |
const apiData = await fetch('/users'); | |
const json = await apiData.json(); | |
console.log("JJJ:", json); |
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
function A(){}; // function declaration | |
var B = function(){}; // function expression | |
var C = (function(){}); // function expression with grouping operators | |
var D = function foo(){}; // named function expression | |
var E = (function(){ // IIFE that returns a function | |
return function(){} | |
})(); | |
var F = new Function(); // Function constructor | |
var G = new function(){}; // special case: object constructor | |
var H = x => x * 2; // ES6 arrow function |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// Chaining | |
var lyrics=[ | |
{line:1,words:"Im a lumberjack and Im okay"}, | |
{line:2,words:"I sleep all night and I work all day"}, | |
{line:3,words:"Hes a lumberjack and hes okay"}, | |
{line:4,words:"He sleeps all night and he works all day"} | |
]; | |
var values = _(lyrics).chain() |
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
var responseJson = [ | |
{type: 'input', id: 'key1', styles:{display:'block', color: 'red'}, someprop:'abc', someotherprop:'bcd'}, | |
{type: 'radio', id: 'key2', styles:{display:'inline', color: 'blue'}, someprop:'xyz', someotherprop:'z'} | |
] | |
var parseResponse = function(response) { | |
var result = []; | |
for (var i=0; i<response.length; i++) { | |
var resultObj = { | |
type: response[i].type, |
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
var responseJson = [ | |
{type: 'input', id: 'key1', styles:{display:'block', color: 'red'}, someprop:'abc', someotherprop:'bcd'}, | |
{type: 'radio', id: 'key2', styles:{display:'inline', color: 'blue'}, someprop:'xyz', someotherprop:'z'} | |
] | |
var parseResponse = function(response) { | |
var result = []; | |
for (var i=0; i<response.length; i++) { | |
var resultObj = { | |
type: response[i].type, |
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
define(function(require){ | |
'use strict'; | |
var React = require('react'); | |
var store = require('./store'); | |
var RegisterForm = require('es6!./registerForm'); | |
var VerifyForm = require('es6!./verifyForm'); | |
var RegisterSuccess = require('es6!./registerSuccess'); | |
var Stepper = require('es6!./stepper'); | |
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
function f1(cb){ | |
console.log("I am f1"); | |
cb(); | |
} | |
function f2(cb){ | |
console.log("I am f2"); | |
cb() | |
} | |
function f3(){ | |
console.log("I am f3"); |
NewerOlder