Skip to content

Instantly share code, notes, and snippets.

View elskwid's full-sized avatar
🤡

Don Morrison elskwid

🤡
View GitHub Profile
@elskwid
elskwid / gist:2422707
Created April 19, 2012 18:09 — forked from phlipper/gist:2422700
Software Colloquialisms

@elskwid is at least equally responsible for this ...

Software Colloquialisms

Sex

  • maintenance release - masturbation
  • continuous integration - daily sex
  • release management - weekly sex on the same day each week
  • fail fast - premature ejaculation
@elskwid
elskwid / probe.rb
Created September 6, 2012 05:57 — forked from supernullset/probe.rb
Weird net/ftp behavior
STDOUT.sync = true
require "net/ftp"
root = "tgftp.nws.noaa.gov"
total = 0
run = true
puts ">> Probing max connections for: #{root}"
@elskwid
elskwid / chat.coffee
Created November 8, 2012 23:26
quick coffee version of node example in Node Up and Running
net = require "net"
sugar = require "sugar"
chatServer = net.createServer()
clientList = []
chatServer.on "connection", (client) ->
client.name = "#{client.remoteAddress}:#{client.remotePort}"
client.write "Hi! #{client.name}!\n"
console.log "#{client.name} joined"
@elskwid
elskwid / Marked.sublime-build
Created November 19, 2012 21:38
Modify Markedapp build for sublime to include command palette entry
{
"cmd": ["open","-a","/Applications/Marked.app","$file"],
"selector": "text.html.markdown",
"variants": [
{
"cmd": ["open","-a","/Applications/Marked.app","$file"],
"name": "Open in Marked"
}
]
}
# encoding: utf-8
class DocumentUploader < CarrierWave::Uploader::Base
include ::CarrierWave::Backgrounder::Delay
include CarrierWave::MimeTypes
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
# include CarrierWave::MiniMagick
include CarrierWave::UNOConv
@elskwid
elskwid / capistrano.rb
Created January 24, 2013 07:02
CAPIFY
# $: << File.expand_path("../../recipes", __FILE__)
# Don't worry about the load path man, Capistrano's got your back!
module Capistrano
if const_defined? :Configuration
Configuration.instance(true).load do
@load_paths << File.expand_path("../recipes", __FILE__)
load "log"
end
end
@elskwid
elskwid / queue.rb
Created February 16, 2013 01:24
Small example of Queue
require 'thread'
q = Queue.new
(0..1000).each{ |i| q << i }
puts q.length
Thread.new do
sleep 1
puts "FIRST #{q.pop}"
end
@elskwid
elskwid / event.rb
Created February 23, 2013 20:35
Enumerator fun
require "active_support/all"
class Event
STATES = %w(active archived)
def self.types(&block)
return to_enum(__callee__) unless block
types = {
@elskwid
elskwid / protomodel.rb
Created May 8, 2013 04:46
Protomodel
# Example of prototyping models with a mix of ActiveRecord and Virtus
#
# Useful with large models where some fields are in flux during spiking/dev
# and you don't want or need to run migrations to try ideas out.
class A < ActiveRecord::Base
# ...
# belongs_to
# has_many
@elskwid
elskwid / modules.rb
Created May 21, 2013 22:32
Playing with modules and bindings
class Configuration
attr_reader :name
def initialize(name)
@name = name
end
end
class ModuleBuilder