Skip to content

Instantly share code, notes, and snippets.

Charles Lowell cowboyd

Block or report user

Report or block cowboyd

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
@cowboyd
cowboyd / dataset.js
Last active Aug 27, 2015
An API to put the fun back in rendering an asynchronous, paginated dataset in JavaScript!
View dataset.js
import Dataset from 'dataset';
import getStuff from 'get-stuff';
// Dataset.js is a JavaScript only object for navigating through paged
// data. It understands that rendering a paged dataset in realtime as
// it is incrementally and asynchronously loaded is no mean feat, and
// so it's got your back.
//
// It's goal is to give you as much information about what exactly is
// happening at any give moment so that you can represent it
View staircase.js
////////////////////////////////////////////////////////////////////////////////
// Staircase exercise //
// Your task is to complete the model for simple stairs //
// Using the provided sizes and colors, complete the staircase //
// and reach the Gold Cup! //
////////////////////////////////////////////////////////////////////////////////
/*global, THREE, Coordinates, $, document, window, dat*/
var camera, scene, renderer;
var cameraControls, effectController;
@cowboyd
cowboyd / paged-dataset.js
Last active Aug 29, 2015
Paged Dataset in Ember Data
View paged-dataset.js
App.PagedDataset = Ember.ArrayProxy.extend({
page: 1,
store: null, //instance of DS.Store
type: null, // the type name of the record array e.g. 'person'
content: Ember.computed('page', function() {
return this.store.find(this.type, {page: this.get('page')});
})
})
var dataset = App.PagedDataset.create({
@cowboyd
cowboyd / robobs.rb
Created Sep 16, 2014
hypothetical ruby DSL for brick pi robot operations
View robobs.rb
# config phase
OperationInstance = Struct.new(:start, :condition, :finish)
class OperationBuilder
def start(&block)
@start = block || proc {}
end
def condition(&block)
View demobot.rb
class DemoBot < BrickPi::Bot
motor :port_A
motor :port_B
property :forward_speed do |value|
motor_A.spin value
motor_B.spin value
end
property :rotation_speed do |value|
@cowboyd
cowboyd / store_helper.coffee
Created Oct 14, 2014
Setting up the store
View store_helper.coffee
# We generally use Mocha not QUnit, so ymmv.
# Basically, make the store available for all test cases so
# they can do setup.
#
# creating fixture data has always been a problem for us, and
# we have yet to find the "sweet" solution
#
# This goes in global spec helper
beforeEach ->
@cowboyd
cowboyd / precompile.rb
Created Oct 29, 2014
Using Precompiled Templates from Ruby
View precompile.rb
require 'handlebars'
# reopen this class to give access to the
# underlying runtime
class Handlebars::Context
attr_reader :js
end
context = Handlebars::Context.new
template = context.js.eval my_precompiled_template
@cowboyd
cowboyd / concerning-net-neutrality.md
Last active Aug 29, 2015
Letter to John Cornyn, United States Senator from Texas
View concerning-net-neutrality.md

Mr Cornyn,

I am the owner of a small tech firm (http://frontside.io) that employees 6 people in Central Texas, so I can assure you that I am driven by pragmatism rather any ideological consideration. Like you, I am concerned with my people and the best way to ensure their continued prosperity.

That is why I find it less important the fashion in which my rights are protected, so long as they remain protected. I am not crazy about net neutrality being enforced by the FCC, but I am, without a doubt, dead set on its enforcement through one means or another. Right now, the FCC is the only governmental body making any stand to protect the fairness of our networks, and so lacking a better option, I feel obligated to support them. If you could commit publicly to a plan to protect net neutrality that does not involve over-regulation or the overreach of a regulatory body such as the FCC, then I would engage with it vigorously, but at the moment the loudest voice in the debate is your colleague and co-senator Ted Cru

@cowboyd
cowboyd / mutable-collection.js
Created Mar 26, 2015
Present a mutable interface to an immutable array and track changes in realtime
View mutable-collection.js
import Ember from 'ember';
/**
* Presents a mutable interface to an immutable array.
*
* As you make changes to the array, it tracks which objects are new,
* which objects have been removed, and which objects were in the
* original array. To use an instance of this class, set the
* `original` property to an array. This array will not be touched as
* you make changes via the mutable interface. E.g.
View upload.js
import Ember from 'ember';
import XHR from 'ember-xhr';
/**
* On the rails server, this creates an active record that stores the
* filename and generates the pre-signed url, the return format is
* something like:
*
* {
* "upload": {
You can’t perform that action at this time.