Skip to content

Instantly share code, notes, and snippets.

🇬🇧 in 🇺🇸 | Engineer @Netflix 📺 | Previously @twitter 🐦, @amzn 🛒

Cameron Hunter cameronhunter

🇬🇧 in 🇺🇸 | Engineer @Netflix 📺 | Previously @twitter 🐦, @amzn 🛒
Block or report user

Report or block cameronhunter

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
View astexplorer.json
"v": 2,
"parserID": "babylon7",
"toolID": "babelv7",
"settings": {
"babylon7": null
"versions": {
"babylon7": "7.0.0",
"babelv7": "7.0.0"

Keybase proof

I hereby claim:

  • I am cameronhunter on github.
  • I am cameronhunter ( on keybase.
  • I have a public key whose fingerprint is 96DA 316E C416 C535 0DBA 285A B518 7FF2 2BD2 4938

To claim this, I am signing this object:

View Identity.css
* Identity
* 1. Ensure that the parent container has a max-width of 0 to
* guarantee correct text-overflow behavior in small widths.
:root {
--Identity-avatar-size: 32px;
View timer.js
class Timer {
static delay(delay) {
return new Timer(
(delay ? (fn) => { setTimeout(fn, delay) } : (fn) => { fn() }),
(delay ? (id) => { clearTimeout(id) } : () => {})
static interval(interval) {
cameronhunter / array.bucket.js
Created Jul 23, 2015
Array#bucket for JavaScript in ES6
View array.bucket.js
Array.prototype.bucket = function(fn) {
const results = [...Array(fn.length)].map(() => []);
const buckets = => bucket.push.bind(bucket));
const noop = () => {};
this.forEach(item => (fn.apply(item, buckets) || noop)(item));
return results;
cameronhunter /
Last active Aug 29, 2015
[Experimental] FlightJS component that intercepts and caches event data.

This is an experiment in unobtrusively caching event data in FlightJS. It's a component which effectively slides between a UI and data component, intercepting requests for data, and caching responses. It doesn't require cache invalidation because it does not prevent the data component from retrieving updated data when there's a cache hit. This allows us to create a snappier UI by providing the "last known" data, but still allowing the data component to fetch and trigger with the most recent data at a later stage.

If a "with_data" mixin existed with methods such as this.get and, then this could be a mixin using advice to surround these functions with caching. Perhaps that's a cleaner way of implementing this functionality – this is just an experiment.

This could also be mixed with the flight-storage component, so that the cached data could be served from localStorage or IndexDB.

cameronhunter / Data Binding Thoughts
Created Jul 31, 2013
Some research and thoughts around data-binding for flight.
View Data Binding Thoughts
## Definition ##
"Data binding is general technique that binds two data/information sources together and maintains synchronization of data." –
UI data binding binds UI elements to an application domain model. Most frameworks employ the Observer pattern as the underlying binding mechanism. To work efficiently, UI data binding has to address input validation and data type mapping.
A bound control is a widget whose value is tied to a field in a recordset (i.e., a column in a row of a table). Changes made to data within the control are automatically saved to the database when the control's exit event triggers.
## Execution ##
cameronhunter / options-or-overloads.scala
Created Apr 19, 2013
Option doesn't solve everything. Sometimes overloaded functions provide a less confusing API.
View options-or-overloads.scala
/* Function using Option */
object Hello {
def to(name: Option[String] = None) =
"Hello " + (name getOrElse "world")
println( // Causes NullPointerException
View holyrood9a.tsv
archie Guacamole Burger Piri piri
stevenm Spiced Lamb Burger Plain
smithali Texas BBQ Burger Piri piri
caluml Guacamole Burger Plain
andthomp Pioneer Burger Plain
drewb Cheese Burger Plain
dominics Chilli Burger Piri piri
ajbailey Shroom Italienne Plain
gthubron Cheese and Bacon Burger Piri piri
andmell Pioneer Burger Piri piri
cameronhunter / responsive-abbreviations.html
Created Oct 2, 2012
Responsive abbreviations in HTML using CSS
View responsive-abbreviations.html
<!doctype html>
<title>Responsive Abbreviations</title>
<style type="text/css">
/* Show "U.K." */
abbr {cursor:default; border:none;}
/* Show "United Kingdom" */
@media (min-width: 481px) {
You can’t perform that action at this time.