Skip to content

Instantly share code, notes, and snippets.

A farmer is looking for some extra help on the farm, so he hires a farmhand. On the first day he puts him to work pounding in fence posts, it's absolutely grueling work under the hot sun, but the farmhand excels at this. He sets up more fence posts than any other farmhand ever has in a day, more than the farmer ever could. The farmer is astounded at how fast the hand worked.

So, the next day, the farmer sets the farmhand up harvesting corn. It's tedious work, there are rows and rows and rows of corn and all day the farmhand is plucking ears of corn in an endlessly monotonous task. At the end of the day, the farmhand delivers a massive collection of corn. He's done it again - he's worked harder and better than anyone could ever do. At this rate the farmer is going to run out of work!

So on the third day, the farmer is trusting the farmhand to make decisions. He leads him into the root cellar and shows him the potatoes. There's a whole heap of them, a weeks worth of work. The farmer says, "I want you to sort

@elliottkember
elliottkember / layerbrowser.coffee
Last active December 14, 2021 12:49
Layer browser for imported Sketch / PSD files in Framer
class LayerBrowser
constructor: (options) ->
@objects = []
@restore = options.restore
@_setup()
@add options.import if options.import
add: (object) ->
@objects.push object
@elliottkember
elliottkember / embiggen.js
Created July 31, 2013 11:29
Embiggen.js - a bookmarklet for expanding images.
javascript:%20var%20x=%20$(%22.content%22).find(%22a%22).each(function()%7Bvar%20href=$(this).attr(%22href%22);if((!$(this).hasClass(%22drowsapMorphed%22))%20&&%20($(this).next(%22.drowsapMorphed%22).length==0)%20&&%20href%20&&%20(href.indexOf('imgur')%3E=0%20%7C%7C%20href.indexOf('jpeg')%3E=0%20%7C%7C%20href.indexOf('jpg')%3E=0%20%7C%7C%20href.indexOf('png')%3E=0))%7Bvar%20ext%20=(href.indexOf('imgur')%3E=0%20&&%20href.indexOf('jpg')%3C0%20&&%20href.indexOf('png')%3C0)%20?%20'.jpg'%20:'';%20var%20img%20=%20$(%22%3Ca%20class='drowsapMorphed'%20href='%22+href+%22'%20target='blank'%20style='display:block'%3E%3Cimg%20style='display:block;max-width:780px;'%20src='%22+href+%20ext+%22'%20/%3E%3C/a%3E%22);$(this).after(img);%7D%7D);
-- volume up 10
set current_volume to output volume of (get volume settings)
if current_volume is less than 100 then
set current_volume to current_volume + 10
end if
set volume output volume current_volume
@elliottkember
elliottkember / spotify.applescript
Created February 22, 2012 12:45
Spotify Applescript
property baseURL : "http://statusboard.dev/song?"
if application "Spotify" is running then
tell application "Spotify"
set theTrack to name of the current track
set theArtist to artist of the current track
set theAlbum to album of the current track
set theurl to spotify url of the current track
try
do shell script "/usr/local/bin/wget --delete-after \"" & baseURL & "&t=" & theTrack & "&a=" & theArtist & "&al=" & theAlbum & "\""
@elliottkember
elliottkember / stateAnimationOptions.coffee
Last active March 14, 2019 14:11
Framer.js per-transition animationOptions!
myLayer.states.stateAnimationOptions =
'a-b':
time: 0.1
'b-c':
time: 0.8
'c-d':
time: 0.5
myLayer.states.add
a: opacity: 1
@elliottkember
elliottkember / AppStateMachine.coffee
Last active August 9, 2018 14:32
A simple application framework for Framer
EventEmitter = (require?("./EventEmitter") || Framer).EventEmitter
class AppStateMachine extends EventEmitter
constructor: ->
@states = []
# Start the state machine with the document's hash, or the given route
start: (name) ->
@go if document.location.hash then document.location.hash[1..-1] else name
@elliottkember
elliottkember / imageSwappingLayer.coffee
Created October 13, 2014 18:39
A layer that fades between images depending on its state
class ImageSwappingLayer extends Layer
images: {}
imageSubLayer: false
imageTransitionTime: 0.5
constructor: (options={}) ->
super options
@imageTransitionTime = options.imageTransitionTime if options.imageTransitionTime
App.SpinnerView = Ember.View.extend
shadow: false
color: '#000'
tagName: 'span'
classNameBindings: [':loading-spinner', 'isButton:button', 'centered:centered']
didInsertElement: ->
opts =
lines: 13, # The number of lines to draw
length: 4, # The length of each line
width: 2, # The line thickness
App.ApplicationSerializer = DS.ActiveModelSerializer.extend
serialize: (record, options) ->
json = @_super record, options
record.eachAttribute (name, attribute) ->
if attribute.options.readOnly
delete json.name
json
App.Object = Ember.Model.extend
name: DS.attr 'string', readOnly: true