Skip to content

Instantly share code, notes, and snippets.

View jamesladd's full-sized avatar
💭
Coding like the wind

James Ladd jamesladd

💭
Coding like the wind
View GitHub Profile
@johncmckim
johncmckim / garden-aid-iot-hub-serverless.yml
Last active November 24, 2017 04:44
Garden Aid - IoT Hub - serverless.yml
service: garden-aid-iot-hub
provider:
name: aws
runtime: nodejs4.3
# custom variable syntax is needed to avoid conflits with aws cloudformation functions
variableSyntax: '\${{([\s\S]+?)}}'
# load custom variables from a file
custom: ${{file(./vars-${{opt:stage}}.yml)}}
@ryan-scott-dev
ryan-scott-dev / gist:9383147
Last active August 29, 2015 13:57
Flatten Nested JSON data to Form Data
flattenNestedFormJSON = function(json) {
if (typeof json === "string" ||
typeof json === "number" ||
typeof json === "boolean" ||
json === null) {
return json;
}
if (typeof json !== "object") {
return null;
@tooky
tooky / gist:3840466
Created October 5, 2012 15:21
BritRuby Talk Proposal - East Oriented Rails

Steve Tooke: East Oriented Rails

James Ladd proposes a compass that we can use to navigate our object-oriented designs. We move North as we travel up a layer, South as we travel down a layer. West will take us away from the object, and East moves us towards another object.

James suggests that we orient our code so that we are always travelling East. In practice this means that code should follow these rules:

  1. All public methods return nil, boolean or return a reference to the current object (self).
  2. Objects that implement the Factory or Builder pattern or similar are an exception.
  3. East is better suited to composite objects, not primitive objects (James doesn’t make this distinction).
tell application "iTunes"
set allSongs to (every file track of playlist "Library")
set idx to random number from 0 to (count of allSongs) - 1
set aSong to item idx of allSongs
play aSong
end tell
%ifndef _newline
SECTION .data
newline: db `\n`
__SECT__:
%define _newline
%endif