Skip to content

Instantly share code, notes, and snippets.

David Fox-Powell dtothefp

Block or report user

Report or block dtothefp

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
View wait-compiled-runtime-helpers-core-regenerator.js
import _regeneratorRuntime from "@babel/runtime-corejs2/regenerator";
import _asyncToGenerator from "@babel/runtime-corejs2/helpers/esm/asyncToGenerator";
import _Promise from "@babel/runtime-corejs2/core-js/promise";
var wait = function wait() {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
return new _Promise(function (res) {
return setTimeout(res, duration);
});
};
View wait-compiled-runtime-helpers.js
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
var wait = function wait() {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
return new Promise(function (res) {
return setTimeout(res, duration);
});
};
export default
@dtothefp
dtothefp / wait-compiled-no-runtime.js
Created Apr 20, 2019
Simple Async Timer Compiled
View wait-compiled-no-runtime.js
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var wait = function wait() {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
return new Promise(function (res) {
return setTimeout(res, duration);
});
};
@dtothefp
dtothefp / wait.js
Last active Apr 20, 2019
Simple Async Timer
View wait.js
const wait = (duration = 100) => new Promise((res) => setTimeout(res, duration));
export default async (duration = 500) => {
console.log('Wait for: ', durtaion);
await wait(duration);
console.log('Finished after: ', durtaion);
};
View recurse-contentful-data.js
/* eslint-disable */
const { intersection } = require(`lodash`);
const { createClient } = require(`contentful`);
const {
createClient: cmaCreateClient,
} = require(`contentful-management`);
(async () => {
const SPACE_ID = `q5lwz1whkyct`;
const {
View webpack-client.config.js
import path from 'path';
import webpack from 'webpack';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import Dotenv from 'dotenv-webpack';
import HardSourceWebpackPlugin from 'hard-source-webpack-plugin';
import { BundleStatsPlugin } from './plugins/BundleStatsPlugin';
import { LoadableStatsPlugin } from './plugins/LoadableStatsPlugin';
import generateStats from './generate-stats';
View local-styles.scss
.even {
background-color: lavenderblush;
}
.odd {
background-color: goldenrod;
}
View local-styles.scss
.even {
background-color: lavenderblush;
}
.odd {
background-color: goldenrod;
}
View advanced-react.js
// HOC and context
// provide context with HOC
import App from './components/App';
import ProvideContext from './containers/ProvideContext';
const transportationTypes = [
'armored car',
'fire engine',
'golf cart',
View sample.jsx
const transportationList = (
<ul>
<li>Armored Car</li>
<li className="active">Hyperloop</li>
</ul>
);
ReactDOM.render(
transportationList,
document.getElementById(‘app’)
You can’t perform that action at this time.