Skip to content

Instantly share code, notes, and snippets.

Pete Hodgson moredip

Block or report user

Report or block moredip

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
@moredip
moredip / test.json
Created Nov 28, 2012
A small sample JSON file
View test.json
{
"test":"json"
}
@moredip
moredip / registerCustomer.coffee
Created Apr 9, 2012
Alternative functional approach to dealing with the async pyramid. This is a response to http://wekeroad.com/2012/04/05/cleaning-up-deep-callback-nesting-with-nodes-eventemitter/
View registerCustomer.coffee
validate = (customer, next)->
console.log 'validating...'
#VALIDATE HERE
next()
insert = (customer, next)->
console.log 'inserting...'
# insert into DB (asynchronously of course), and then call...
next()
@moredip
moredip / part-app.js
Last active Jul 13, 2017
Introduce Partial Application
View part-app.js
const priceByCommodityAndCountry = {
'MANGO': [
{
origin: 'US',
price: 101
},
{
origin: 'BR',
price: 120
@moredip
moredip / -README.md
Last active Jul 3, 2017
functionally-stateful
View -README.md

stateful()

A helper function that lets us write stateful React components in the same functional style as stateless components.

Why?

  • sidesteps the need to introduce class and this-binding confusion into your codebase.
  • slightly terser, slightly more declarative
  • opinionated - doesn't expose the more dangerous features of class-based Components (e.g. lifecycle callbacks)

When you have a team working on a larger React codebase it is hard for everyone to understand which patterns are preferable vs. those which are a necessary compromise.

@moredip
moredip / run-command-on-git-revisions
Created May 8, 2011
A quieter version of Gary Bernhardt's script, with timestamps
View run-command-on-git-revisions
#!/bin/bash
#
# This script runs a given command over a range of Git revisions. Note that it
# will check past revisions out! Exercise caution if there are important
# untracked files in your working tree.
#
# This came from Gary Bernhardt's dotfiles:
# https://github.com/garybernhardt/dotfiles
#
# Example usage:
View keybase.md

Keybase proof

I hereby claim:

  • I am moredip on github.
  • I am petehodgson (https://keybase.io/petehodgson) on keybase.
  • I have a public key whose fingerprint is C102 5F19 DE0B 2154 8873 6DBB 53A8 A903 4518 61FF

To claim this, I am signing this object:

@moredip
moredip / gist:7557707
Last active Dec 28, 2015
exporting a bunch of public keys
View gist:7557707
for i in pete rosalie jack charlton pam coleman badri sophie elise jess; do gpg --armor --export $i > $i.signed.gpg; done
View what I have.m
+ (void)prepRoutes{
[self handlePostTo:@"/record" with:^{
return [[LPRecordRoute new] autorelease];
}];
[self handlePostTo:@"/play" with:^{
return [[LPAsyncPlaybackRoute new] autorelease];
}];
@moredip
moredip / build.rb
Created Aug 19, 2012
A very hacky build script using Guard
View build.rb
require 'fileutils'
def run_guard
Signal.trap("HUP") { exit }
require 'guard'
Guard.setup
Guard::Dsl.evaluate_guardfile(:guardfile => 'Guardfile')
Guard.start
end
@moredip
moredip / gist:3080744
Created Jul 10, 2012
Simple Privacy Policy
View gist:3080744
We don't have access to and will not store, or use any of your information or data or stuff for any reason.
You can’t perform that action at this time.