Skip to content

Instantly share code, notes, and snippets.

View cameronbourke's full-sized avatar

Cameron Bourke cameronbourke

  • Sydney, Australia
View GitHub Profile
@cameronbourke
cameronbourke / gist:f4b70284a77bccb72ada
Created June 11, 2015 02:34
In App Purchase Cordova Plugin Init Error
2 933686 log store is ready
3 933701 log [store.js] DEBUG: store.queries !! 'com.ionicframework.id.0 registered'
4 933704 log [store.js] DEBUG: store.queries !! 'singleZonesProduct0 registered'
5 933706 log [store.js] DEBUG: store.queries !! 'non consumable registered'
6 933711 log [store.js] DEBUG: store.queries !! 'registered'
7 933715 log [store.js] DEBUG: store.queries !! 'com.ionicframework.id.0 updated'
8 933722 log [store.js] DEBUG: store.queries !! 'singleZonesProduct0 updated'
9 933724 log [store.js] DEBUG: store.queries !! 'non consumable updated'
10 933726 log [store.js] DEBUG: store.queries !! 'updated'
11 933732 log [store.js] DEBUG: store.queries !! 'com.ionicframework.id.1 registered'
@cameronbourke
cameronbourke / tutsplus.es6.js
Created October 28, 2015 08:18
Took the ES5 output of the tuts+ course on functional programming, http://code.tutsplus.com/courses/functional-programming-in-javascript, and slapped some ES6 in there instead.
!function(_) {
'use strict';
let beerData = JSON.parse(document.getElementById("beerData").textContent),
allBeers = beerData.beers,
beerTemplate = document.getElementById("tmpl-beer-groups").textContent,
beerList = document.getElementById("beerList"),
averageAbv = document.getElementById("averageAbv"),
filters = document.getElementById("filters"),
const heyListen = (() => {
let listeners = {
once: {},
on: {}
}
const _assignListener = (target, name, listener) => {
if(target[name]) {
target[name].push(listener);
} else {
@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;
const memoize = (fn) => {
let cache = {}, key;
return (...args) => {
key = JSON.stringify(args);
return cache[key] || (cache[key] = fn.call(null, ...args));
}
};
"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'"
}
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) => {
...
renderHead () {
return (
<Helmet
titleTemplate={'%s | ' + config.siteName}
meta=[{ ... }]
links={[{
rel='icon',
type='image/png',
<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">
new CopyWebpackPlugin([
...
{
from: path.resolve(__dirname, '../public/favicons'),
to: path.resolve(__dirname, '../build'),
},
]);