Skip to content

Instantly share code, notes, and snippets.

View rboyd's full-sized avatar

Robert Boyd rboyd

  • Anarchist
  • Bentonville, AR
View GitHub Profile
@raine
raine / spotify_mute_ads.rb
Created March 31, 2010 11:08
Mute Spotify ads on OS X
# coding: utf-8
#!/usr/bin/env ruby
#
# Mutes Spotify ads by monitoring Growl's output in syslog, and changing the
# system-wide audio output to dummy output when an ad is detected.
#
# == Installation
#
# 1. Install Soundflower (http://code.google.com/p/soundflower/)
# 2. Run the following command in your home directory, or wherever you prefer.
@tbatchelli
tbatchelli / pallet-vmfest.md
Created March 12, 2011 20:25
Setup pallet with vmfest
  1. Install VirtualBox on your machine
  2. Disable login credential: $ VBoxManage setproperty websrvauthlibrary null
  3. Download and uncompress the following image https://s3.amazonaws.com/vmfest-images/ubuntu-10-10-64bit-server.vdi.gz
  4. Clone the image to the directory where you want it to be permanently stored: $ VBoxManage clonehd /path/to/downloaded/ubuntu-10-10-64bit-server.vdi /path/to/permanent/location/ubuntu...-server.vdi
    • This should produce a uuid for your new image. Keep it around
  5. Start VirtualBox (the GUI) and:
    1. Create an new image Linux - Ubuntu (64bit)
  6. Select "Use existing hard disk" and if your newly cloned image doesn't appear in the drop-down list, click on the folder icon and find the image in your hard disk (the one you just cloned)
@fnhipster
fnhipster / html5.haml
Created April 9, 2011 01:19
HTML5 HAML Template
!!! 5
%html
%head
%title= "Your Website"
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
%link{ :href => "/css/screen.css", :media => "screen", :rel => "stylesheet" }
@mxswd
mxswd / classdiagram.gv
Created September 21, 2011 01:13
Class Diagram / ERD Graphviz example. Compile with `dot -Tpdf diagram.gv > diagram.pdf`
digraph models_diagram {
graph[overlap=false, splines=true]
"Venue" [shape=record, label="{\
Venue|name :string\l\
}"]
"User" [shape=record, label="{User|\
email :string\l\
password :string\l\
}"]
@mitchellh
mitchellh / gist:1277049
Created October 11, 2011 01:30
Configure Vagrant VM to use Host DNS for VPN
Vagrant::Config.run do |config|
# ...
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
@chrisguitarguy
chrisguitarguy / wpse-remote-auth.php
Created January 21, 2012 16:51
Check WordPress usernames/passwords remote.
<?php
/*
Plugin Name: Authenticate Users Remotely
Author: Christopher Davis
Author URI: http://www.christopherguitar.net/
License: GPL2
*/
add_filter('xmlrpc_methods', 'wpse39662_add_login_method' );
/**
@tbeseda
tbeseda / _instagram_thumbnail_handlebars_template.haml
Created May 22, 2012 22:24
How I do one-off front-end templating with Handlebars, HAML, and CoffeeScript.
%script#instagram-thumbnail-popover{type: "text/x-handlebars-template"}
%img{src: "{{images.low_resolution.url}}"}/
%i.icon-heart/
{{likes.count}} likes
%script#instagram-thumbnails{type: "text/x-handlebars-template"}
%ul.thumbnails
{{#data}}
%li.span1
%a.thumbnail{href: "{{link}}", title: "{{caption.text}}", data: {content:"{{> popover}}"}}
@jboner
jboner / latency.txt
Last active May 23, 2024 06:51
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@stuarthalloway
stuarthalloway / Datomic News Updates
Created June 18, 2012 14:53
Datomic update examples against a social news database
;; Datomic example code
;; demonstrates various update scenarios, using a news database
;; that contains stories, users, and upvotes
;; grab an in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))
;; borrowed from ibdknox/jayq
(defn map->js [m]
(let [out (js-obj)]
(doseq [[k v] m]
(aset out (name k) v))
out))
(defn clj->js
"Recursively transforms ClojureScript maps into Javascript objects,
other ClojureScript colls into JavaScript arrays, and ClojureScript