Skip to content

Instantly share code, notes, and snippets.


Dan Harper danharper

Block or report user

Report or block danharper

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
danharper / Redirector.js
Last active Aug 29, 2015
Mess to transition in async action creators for redux-react-router
View Redirector.js
import { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { transitionTo } from 'redux-react-router'
export const transitionNext = url => ({ type: NEXT_URL, payload: url })
export const clearNextUrl = () => ({ type: CLEAR_NEXT_URL })
danharper /
Last active Aug 29, 2015
Validation Library

To define your validation rules, provide a Map. Keys are field names, values are either a validation rule, or an array of validation rules.

// one rule
const rules = new Map([
  ['name', required]

// multiple rules
const rules = new Map([
danharper /
Created Jun 26, 2015
enable Chrome Dev Tools debugging of PhoneGap Build apps on Android

Inside config.xml add the following attribute to the widget element:


(For example, it looks like this for me:)

<widget id="com.radweb.ibgo"
danharper /
Last active Apr 16, 2020
Open native Maps apps on iOS and Android in Cordova
iOS (with pin, iOS will lookup address too and show that as label)
Android, no pin (just open at location)
View gist:a07f939673ce108077dc
activate: function(row) { jQuery(row).addClass('active') },
deactivate: function(row) { jQuery(row).removeClass('active') },
rowSelector: 'li.level1.parent',
exitMenu: function() { return true; }
danharper / query-params.php
Last active Aug 29, 2015
query params. experiment in something a little different
View query-params.php
namespace param {
class QueryParam {
const SINGLE = 'single';
const MANY = 'many';
const MANY_CSV = 'csv';
public $queryField;
private $nullable = false;
danharper / CatchAllOptionsRequestsProvider.php
Last active Apr 8, 2020
Lumen with CORS and OPTIONS requests
View CatchAllOptionsRequestsProvider.php
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
class CatchAllOptionsRequestsProvider extends ServiceProvider {
View decorators.js
@ngInject('bus', '$ionicModal')
class Adder {
constructor(num) {
this.num = num
// order matters
// if you @swallow first, then @log won't log caught exceptions
danharper / BorderedInput.js
Last active May 16, 2016
BorderedInput, with Material design style focus animation. Preview:
View BorderedInput.js
// note there may be a better way to abuse flexbox than this :)
var React = require('react-native')
var { View, TextInput } = React
var BorderedInput = React.createClass({
getInitialState() {
return { i: 0 }
View async-await.js
async function sleep(ms) {
return new Promise(r => setTimeout(r, ms))
async function foo() { console.log('s foo'); await sleep(2000); console.log('d foo'); return 'foo'; }
async function bar() { console.log('s bar'); await sleep(1000); console.log('d bar'); return 'bar'; }
async function baz() { console.log('s baz'); await sleep(2000); console.log('d baz'); return 'baz'; }
async function run() {
You can’t perform that action at this time.