Skip to content

Instantly share code, notes, and snippets.

View cameronbourke's full-sized avatar

Cameron Bourke cameronbourke

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/mstile-70x70.png"/>
<square144x144logo src="/mstile-144x144.png"/>
<square150x150logo src="/mstile-150x150.png"/>
<square310x310logo src="/mstile-310x310.png"/>
<wide310x150logo src="/mstile-310x150.png"/>
<TileColor>#132935</TileColor>
<Helmet
titleTemplate={"%s | " + config.siteName}
meta={[{
name: 'apple-mobile-web-app-title',
content: config.appName,
}, {
...
}]}
/>
const handleRouterUpdate = function () {
// import bowser from 'bowser';
if (bowser.msedge) {
// wrapping in a setTimeout ensures that it runs
// after the route has finished transitioning
setTimeout(() => {
const favicons = document.querySelectorAll('link[rel="icon"]');
Array.prototype.forEach.call(favicons, (fav) => { fav.href = fav.href; });
}, 0);
}
new CopyWebpackPlugin([
...
{
from: path.resolve(__dirname, '../public/favicons'),
to: path.resolve(__dirname, '../build'),
},
]);
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="36x36" href="/android-chrome-36x36.png">
<link rel="icon" type="image/png" sizes="48x48" href="/android-chrome-48x48.png">
<link rel="icon" type="image/png" sizes="72x72" href="/android-chrome-72x72.png">
<link rel="icon" type="image/png" sizes="96x96" href="/android-chrome-96x96.png">
<link rel="icon" type="image/png" sizes="144x144" href="/android-chrome-144x144.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png">
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
...
renderHead () {
return (
<Helmet
titleTemplate={'%s | ' + config.siteName}
meta=[{ ... }]
links={[{
rel='icon',
type='image/png',
import React, { StyleSheet, Alert, TouchableOpacity } from 'react-native';
import codePush from 'react-native-code-push';
import Promise from 'promise';
const { PENDING } = codePush.UpdateState;
const { IMMEDIATE } = codePush.InstallMode;
export const downloadNewVersion = (downloadProgressCallback) => {
return new Promise((resolve, reject) => {
"scripts": {
"build:ios": "node node_modules/react-native/local-cli/cli.js bundle --entry-file='index.ios.js' --bundle-output='./ios/ShootstaCue/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
}
const memoize = (fn) => {
let cache = {}, key;
return (...args) => {
key = JSON.stringify(args);
return cache[key] || (cache[key] = fn.call(null, ...args));
}
};
@cameronbourke
cameronbourke / immutable-array-methods.es6.js
Last active October 30, 2016 08:29
After watching Dan Abramov's egghead series on Redux, https://egghead.io/lessons/javascript-redux-the-single-immutable-state-tree, I quickly played around with how native array methods in javascript could be immutable. This is focused on the methods not like map, reduce, filter etc which already don't mutate the array.
const pop = (array) => array.splice(0, -1);
const push = (array, el) => [...array, el];
const splice = (array = [], startCount, deleteCount = 0, ...elements) => {
const { length } = array;
let remainder = startCount + deleteCount;
if(startCount > length || startCount <= -length) {
startCount = 0;