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
import { useState, useRef, useEffect, useCallback } from 'react'; | |
interface CountdownOptions { | |
onComplete: () => void; | |
onTick?: () => void; | |
interval: number | null; | |
} | |
export function useCountdown(endTime: number, options: CountdownOptions) { | |
const [count, setCount] = useState<number | null>(null); | |
const intervalIdRef = useRef<number | null>(null); |
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
import { useState, useEffect, useRef, useCallback } from 'react'; | |
export default (initialState) => { | |
const [state, setState] = useState(initialState); | |
const cbRef = useRef(null); | |
const setStateCallback = useCallback((state, cb) => { | |
cbRef.current = cb; | |
setState(state); | |
}, []); |
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
{ | |
packageName: 'babel-eslint', | |
versionNumber: '^6.26.3', | |
dependencies: [ | |
{ | |
packageName: 'babel-core', | |
versionNumber: '^8.2.6', | |
dependencies: [ | |
{ | |
packageName: 'babel-bla', |
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
Basic Usage: | |
--compilation_level (-O) VAL : Specifies the compilation level to | |
use. Options: WHITESPACE_ONLY, | |
SIMPLE, ADVANCED (default: SIMPLE) | |
--env [BROWSER | CUSTOM] : Determines the set of builtin externs | |
to load. Options: BROWSER, CUSTOM. | |
Defaults to BROWSER. (default: | |
BROWSER) | |
--externs VAL : The file containing JavaScript | |
externs. You may specify multiple |
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
{ | |
"name": "primer", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"ampersand-app": "^2.0.0", | |
"ampersand-model": "^8.0.0", | |
"ampersand-state": "^5.0.2", | |
"ampersand-view": "^10.0.1", |
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
'use strict'; | |
var CONSTS = require("./components/consts"); | |
var _ = require("./components/utils"); | |
var method = "GET"; | |
var baseUrl; | |
var initialize = function(){ | |
baseUrl = buildEntrypoint(CONSTS.API.version,CONSTS.API.publisher.id); | |
}; |
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
// merge two objects to one merged object; | |
var extend = function(defaults, options) { | |
var extended = {}; | |
copyObj(extended, defaults); | |
copyObj(extended, options); | |
// var prop; | |
// for (prop in defaults) { | |
// if (Object.prototype.hasOwnProperty.call(defaults, prop)) { | |
// extended[prop] = defaults[prop]; | |
// } |
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 buildQueryStrings(){ | |
var queries = []; | |
var keys = Array.prototype.slice.call(arguments); | |
var val; | |
keys.forEach(function(key){ | |
val = retreiveValue(key, config); | |
queries.push(key + "=" + val); | |
}); | |
// queries.push(key + "=" + (config[key] ? config[key] : config[subkeys[0]][subkeys[1]])) ; | |
return "?" + queries.join("&"); |
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 getCount(str) { | |
var vowelsCount = 0; | |
strArr = str.split(''); | |
strArr.forEach(vowelCounter); | |
return vowelsCount; | |
// helper | |
function vowelCounter(letter) { | |
var vowels = ['a','e','i','o','u']; |
NewerOlder