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 getURLParameters(url) { | |
var result = {}; | |
var searchIndex = url.indexOf("?"); | |
if (searchIndex == -1) return result; | |
var pageUrl = url.substring(searchIndex + 1); | |
var urlVariables = pageUrl.split('&'); | |
for (var i = 0; i < urlVariables.length; i++) { | |
var parameterName = urlVariables[i].split('='); | |
result[parameterName[0]] = parameterName[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
import Promise from 'bluebird' | |
Promise.config({ | |
warnings: false, | |
cancellation: true, | |
}) | |
const convertJson = string => { | |
try { | |
return JSON.parse(string); |
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
/** | |
* Calculate the offset in the duration of time ellapsed | |
* | |
* @param t time from 0 to 1 (start to end) | |
*/ | |
const easing = (t) => t * t; | |
/** | |
* Scroll to the element with an animation | |
* @param {HTMLElement} element |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
const { series, parallel } = require('./orchestrator.js'); | |
const buildSync = () => 'this was build synchronously'; | |
const buildAsync = () => Promise.resolve('this could have been made asyncronously'); | |
const tasks = series( | |
series(buildAsync, buildAsync), | |
series(buildAsync, buildSync), |
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
root = true | |
[*] | |
indent_style = space | |
indent_size = 2 | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true | |
[*.md] |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>SSE</title> | |
</head> | |
<body> | |
<script> |
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 { withTimer } from './with-timer' | |
withTimer(() => { | |
const c = document.createElement('canvas') | |
document.body.appendChild(c) | |
const cc = c.getContext('2d') | |
let hue = 0 | |
return () => { | |
hue++ |
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
// Create the controller that sends a signal if | |
// an abort is requested by the api | |
const abortController = new AbortController(); | |
// create a fetch, and pass the signal from the controller to | |
// the fetch options | |
const request = fetch('http://my-awesome-site.com/api/awesome', { | |
signal: abortController.signal, | |
}); |
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 { Dispatch } from 'redux'; | |
type StoreState = any; // preferable this should be the real Type of the store | |
/** Default action with just the type */ | |
interface Action<T extends string> { | |
readonly type: T; | |
} | |
/** Action extended with a payload that could be any value, used for the reducer */ |
OlderNewer