Skip to content

Instantly share code, notes, and snippets.

View ayoola-solomon's full-sized avatar
:octocat:
WIP 🚓

Solomon Ayoola ayoola-solomon

:octocat:
WIP 🚓
View GitHub Profile
import path from 'path';
import webpack from 'webpack';
import merge from 'lodash.merge';
const DEBUG = !process.argv.includes('--release');
const VERBOSE = process.argv.includes('--verbose');
const WATCH = global.WATCH === undefined ? false : global.WATCH;
const AUTOPREFIXER_BROWSERS = [
'Android 2.3',
'Android >= 4',
@ayoola-solomon
ayoola-solomon / a.js
Created February 22, 2018 14:28
promise idea
export const fetchCache = (key) =>
new Promise(resolve => {
resolve(getCache(key)); // will return undefined is not available.
});
// in the action then you can do this
fetchCache(CLIENT_API.calculatedJson)
.then(data => {
if (data) {
return data;
const monthlyRateColumn = ({ showDuration, monthlyRate, duration }) => ({
text: columnText('currency', monthlyRate),
subText: showDuration && (
<span>
{bankItemContent.rate.monthly}{' '}
<Text fontWeight={fontWeight.BOLD}>
{contentWithParams(bankItemContent.rate.duration, { duration })}
</Text>
</span>
),
@ayoola-solomon
ayoola-solomon / braking.md
Last active August 13, 2018 19:45
Fahrschule
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export function withAppContext<
P extends { appContext?: AppContextInterface },
R = Omit<P, 'appContext'>
>(
Component: React.ComponentClass<P> | React.StatelessComponent<P>
): React.SFC<R> {
return function BoundComponent(props: R) {
return (
{"lastUpload":"2019-05-03T15:32:31.178Z","extensionVersion":"v3.2.9"}
@ayoola-solomon
ayoola-solomon / checkWebPSupport.js
Last active May 15, 2021 20:29
react hook to check webp support
// https://developers.google.com/speed/webp/faq#how_can_i_detect_browser_support_for_webp
// 'callback(feature, result)' will be passed back the detection result (in an asynchronous way!)
export const checkWebPSupport = callback => {
const kTestImages = {
lossy: 'UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA'
}
const img = new Image()
img.onload = () => {
const result = img.width > 0 && img.height > 0