Skip to content

Instantly share code, notes, and snippets.

View ltk's full-sized avatar

Lawson Jaglom-Kurtz ltk

View GitHub Profile
@ltk
ltk / sheeeet.js
Last active August 29, 2015 13:55
Sheeeet | A work-in-progress Google Spreadsheet library for javascript
// Pronounced like http://shiiiit.com/
var Sheeeet = (function(_) {
var cells = [];
function Cell(data) {
this.content = data.content;
this.row = data.row;
this.column = data.col;
@ltk
ltk / 0_reuse_code.js
Created February 7, 2014 14:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ltk
ltk / _demo.js
Last active August 29, 2015 14:10
Web Audio Handbell Sound Component
window.AudioContext = window.AudioContext || window.webkitAudioContext
var Bell = require('./Bell')
var bell = new Bell( new AudioContext() )
bell.ring('c4')
@ltk
ltk / responder.rb
Created April 6, 2015 18:12
Graba Slack Responder
class Slack::Responder
def initialize(message)
@message = message
end
def respond?
response.present?
end
@ltk
ltk / post.md
Last active August 29, 2015 14:27
Connor Lay Blog Post 08/2015

Slimming Down Your Models and Controllers with Concerns, Service Objects, and Tableless Models.

The Single Responsibility Principle

“A class should have one, and only one, reason to change.” - Uncle Bob

The single responsibility principle asserts that every class should have exactly one responsibility. In other words, each class should be concerned about one unique nugget of functionality, whether it be User, Post or InvitesController. The objects instantiated by these classes should be concerned with sending and responding to messages pertaining to their responsibility and nothing more.

Fat models, thin controllers

@ltk
ltk / app.rb
Created June 1, 2012 03:29
Instagram Hashtag RSS Parser in Sinatra
# app.rb
require 'sinatra'
require 'net/http'
require 'rexml/document'
class Photo
attr_reader :src, :caption, :first
def initialize(src, caption, count)
@src, @caption = src, caption
@ltk
ltk / test_module.less
Created December 12, 2012 18:35
Test Module - A module to show a useless div containing a link
@module-width: 50px;
@module-height: 100px;
@module-link-color: @blue;
div.module {
width: @module-width;
height: @module-height;
background: @module-background;
a {
@ltk
ltk / rules.json
Last active December 9, 2015 22:54
puppy bowl firebase rules
{
"rules": {
".read": false,
".write": false,
"broadcast": {
".read": true,
".write": "root.child('users/' + auth.uid + '/admin').val() === true"
},
@ltk
ltk / input_output.txt
Created May 1, 2013 18:35
Input/Output
Input
|---------------------------------------|
| Search Phrase | Total Searches |
| ======================================|
| Lemurs | 1,000 |
| durham bulls | 500 |
| bull fighting | 100 |
| lemur dance | 2,000 |
| Durham | 700 |
| How to catch a lemur | 35 |
@ltk
ltk / update-subscriptions.js
Created February 2, 2016 21:51
BaaS at Scale | Update Subscription Granularity
// Method 1: High Data Usage
// =========================
const rootReference = new Firebase(firebaseUrl)
const itemsReference = rootReference.child('items')
itemsReference.on('value', function(data) {
// Update the UI with the items update
})