Skip to content

Instantly share code, notes, and snippets.

Jordan Rickman JordanRickman

Block or report user

Report or block JordanRickman

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
@JordanRickman
JordanRickman / sketch_apr01a.ino
Created Apr 2, 2019
ATTiny Sketch for Homemade Hardware
View sketch_apr01a.ino
const float FACTOR = 1.05946; // One semitone
float freq = 440;
const int BUTTON_UP = 3;
const int BUTTON_DOWN = 4;
const int SPEAKER = 0;
bool up_pressed = false;
bool down_pressed = false;
@JordanRickman
JordanRickman / index.html
Last active Mar 7, 2019
Sound in Space: Mono Assignment
View index.html
<html>
<head>
<script src="https://unpkg.com/tone@13.4.9/build/Tone.js"></script>
<script src="sketch.js"></script>
</head>
<body>
<button id="playbutton">
Play
</button>
</body>
@JordanRickman
JordanRickman / ConnectorPattern.md
Last active May 18, 2017
The Connector OOP Pattern
View ConnectorPattern.md

Connectors: A Design Pattern for Maintaining Consistent Object Relationships

The entities in an application's domain model are defined in large part by their relationships between them. The basic three are one-to-one, one-to-many, and many-to-many, but additional invariants may be layered on top of these. In a traditional OOP style, entities are responsible for maintaining these invariants, via logic in their public mutator methods. I propose an alternative that I call the connector pattern. In the connector pattern, object relationships are created and destroyed (connected and disconnected) by a third object called a Connector.

Why Connectors?

While objects should be responsible for maintaining their own local invariants, relationships are not local. They encompass both objects involved in a relationship. As a result, mutator methods on both objects must enforce a shared invariant. If a Foo has many Bars, then Foo.addBar(Bar) and Bar.setFoo(Foo) should be equivalent operations. These two meth

@JordanRickman
JordanRickman / bound-privileged-method.js.md
Last active Mar 3, 2017
Bound Privileged Method Pattern
View bound-privileged-method.js.md

JavaScript Pattern: The Bound Privileged Method

Information Hiding in JavaScript

In JavaScript, we can exploit closure to create private variables. Like so:

function Constructor() {
  var count = 0;
  this.getCount = function() { return count; };
  this.increment = function() { count++; };
You can’t perform that action at this time.