Skip to content

Instantly share code, notes, and snippets.

View export-mike's full-sized avatar
📱
GO, React, React Native, Node.js in Syndey Australia

Mike James export-mike

📱
GO, React, React Native, Node.js in Syndey Australia
View GitHub Profile
@export-mike
export-mike / promote-to.sh
Last active June 9, 2016 09:37
promote-to { qa | uat | default } { patch | minor | major }
#!/usr/bin/env bash
export NOHGHOOK=true
TO="$1"
SEMVER_ACTION="$2"
FROM="$(hg branch)"
echo "promoting $FROM to $TO"
if [[ "$TO" == "qa" ]] || [[ "$TO" == "uat" ]] || [[ "$TO" == "default" ]]; then
if [[ "$SEMVER_ACTION" == "major" ]] || [[ "$SEMVER_ACTION" == "minor" ]] || [[ "$SEMVER_ACTION" == "patch" ]]; then
npm version $SEMVER_ACTION
fi
@export-mike
export-mike / requestOnLoadExample.js
Created April 15, 2016 10:12
built a higher order component for a redux app its inspired by redux form but its for a specific use case. say you have a route/container that needs to fetch some data on componentWillMount and have the flags provided for submitting and error. this higher order component means you don’t need to write any flux stuff, just use the HOC
import requestOnLoad from 'request-on-load';
const {myApiRequest} from '../ApiClient';
class MyComponent extends React.Component {
componentWillMount() {
this.props.request(() => myApiRequest());
}
return (
@export-mike
export-mike / song.js
Last active April 3, 2016 19:38
Old Mc donald had a farm, intel edison with grove buzzer and lcd
var LCD = require('jsupm_i2clcd');
var myLcd = new LCD.Jhd1313m1 (0, 0x3E, 0x62);
var messages = [['Old Mc Donald', 'Had A farm', [18,239,99]],
['Eee I Eee I Oh', 'an on that farm he had a ', [18,239,99]],
['DUck', 'There a quack everwhere a quack quack', [18,239,99]]];
var pos = 0;
setInterval(function() {
var message=messages[pos];
@export-mike
export-mike / location.js
Last active March 5, 2016 17:53
Cradle wrapped up into a simple and lean api for creating simple and complex models in couchdb.
import randomString from 'random-string';
import Uuid from 'node-uuid';
import {couchUpdate, couchSave, couchView, couchDesignDoc} from '../helpers/couch';
const TYPE = 'Location';
export const save = (location) => {
return couchSave(Uuid.v4(), {
type: TYPE,
address: location.address,
postcode: location.postcode,
@export-mike
export-mike / tito-twitter-list
Last active February 13, 2016 23:55
lnug-tito-twitter-hook.io
module['exports'] = function titoTwitterList (hook) {
var body = hook.req.body;
var twitterAnswer = body.answers.filter(function (a) {
return a.question.title === 'Twitter';
})[0];
if (twitterAnswer && twitterAnswer.response) {
@export-mike
export-mike / gist:322e6c340294113096b6
Last active January 24, 2016 11:54
Problems with babel anonymous functions becoming named breaks couchdb.
// Before transpile
couchDesignDoc('User', {
email: {
map: (doc) => {
if(doc.type === 'User') {
emit(doc.email, doc);
}
}
}
@export-mike
export-mike / App.js
Last active January 14, 2016 16:31
TopLevel Stateless Component not updating with react transform, from
import React, { Component } from 'react';
import { NICE, SUPER_NICE } from './colors';
class Counter extends Component {
constructor(props) {
super(props);
this.state = { counter: 0 };
this.interval = setInterval(() => this.tick(), 1000);
}
@export-mike
export-mike / intel.realsense.clean.js
Created October 27, 2015 16:33
intel.realsense.clean.js no logging. well most of it removed. use a consistent method of logging!
/*******************************************************************************
INTEL CORPORATION PROPRIETARY INFORMATION
This software is supplied under the terms of a license agreement or nondisclosure
agreement with Intel Corporation and may not be copied or disclosed except in
accordance with the terms of that agreement
@licence Copyright(c) 2014-2015 Intel Corporation. All Rights Reserved.
*******************************************************************************/
var intel = intel || {};
@export-mike
export-mike / gist:07ab376dd666545c64c0
Created February 27, 2015 16:44
A simple hide and show printable areas. see example on jsfiddle: http://jsfiddle.net/57tyc9kj/
(function ($) {
$('.print-me').on('click', function () {
var $areaToPrint = $($(this).data('print-me'));
var $hiddenAreas = $('.hide-print');
if ($areaToPrint.length) {
$hiddenAreas.hide();
$areaToPrint.show();
window.print();
$hiddenAreas.show();
@export-mike
export-mike / SassMeister-input.scss
Created January 21, 2014 09:51
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
@import "compass";
$primary-color:red;
body{