Skip to content

Instantly share code, notes, and snippets.

View danott's full-sized avatar
📈
Chart with upward trend

Dan Ott danott

📈
Chart with upward trend
View GitHub Profile
@danott
danott / messin_around_in_industry_inc.py
Created February 4, 2014 01:48
Script for Industry Inc in DrawBot
textToRender = "Neato!"
fontSizeToRender = 1062
fontSize(fontSizeToRender)
width, height = textSize(textToRender)
width = width * 1.4
size(width, height)
# Centering. Needs to be fine tuned
func doSomethingWithIntish(i int) {
// whatever
}
doSomethingWithInt(1)
// type time.Month int
doSomethingWithInt(time.January)
@danott
danott / deploy.rb
Created March 11, 2014 15:14
Make deploys better by adding this to the top of your Ruby based deploy scripts.
if ARGV.join.match("--push-it-to-the-limit") || ENV['ALWAYS_BE_PUSHING_IT_TO_THE_LIMIT']
puts "Pushing it to the limit."
system(%[osascript -e 'tell app "Rdio" to play source "t13182620"'])
end
@danott
danott / ballard_walking_brewery_tour.md
Last active August 29, 2015 13:57
A listing of Ballard breweries, for friends coming to Seattle.
@danott
danott / idea.go
Created April 24, 2014 16:05
This is how I think go versioning could work...
package main
import (
// mypackage "github.com/danott/mypackage"
mypackage "some-clever-service-name-for-versioning-go-programs.com/danott/mypackage/0.0.1"
)
func main() {
mypackage.ExportedFun()
}
@danott
danott / null_object.rb
Last active August 29, 2015 14:01
The Null Object Pattern as an ActiveSupport Concern.
module NullObject
extend ActiveSupport::Concern
included do
const_set("Null#{name}", Class.new)
end
module ClassMethods
def null
const_get("Null#{name}").new
# required on jsbin
Batman.config.usePushState = false
simpleStore = new Batman.Set()
simpleStore.add new Batman.Object({name: "Red"})
simpleStore.add new Batman.Object({name: "Green"})
simpleStore.add new Batman.Object({name: "Blue"})
class App extends Batman.App
@root "colors#index"
@danott
danott / view.coffee
Created July 24, 2014 23:38
How to propogate events up the batman view tree, similar to EventBinding
class App.BehavesLikeEventBindingView extends Batman.View
fireOnSelfAndNearestAncestor: (event, args...) ->
@[event]?.apply(@, args)
if target = @superview?.targetForKeypath(event)
target[event].apply(target, args)
@danott
danott / github_labels.js
Created August 5, 2014 19:52
GitHub Labels
// ==UserScript==
// @name GitHub Labels
// @namespace http://danott.co/
// @version 0.1
// @description Automatically add and remove "+1", "+2", and "NOT READY!" labels bast on comment contents. Included on all of github because pushState.
// @include https://github.com/*
// @copyright 2014+, @danott
// ==/UserScript==
var getLabelName = function() {
@danott
danott / sum.rb
Last active August 29, 2015 14:04
ActiveSupport sum
# In rails console.
dumb = Struct.new(:field_with_name)
[dumb.new(1), dumb.new(2), dumb.new(3)].sum(&:field_with_name)