Skip to content

Instantly share code, notes, and snippets.

View darkhelmet's full-sized avatar
🏠
Working from home

Daniel Huckstep darkhelmet

🏠
Working from home
View GitHub Profile
@darkhelmet
darkhelmet / gist:2977159
Created June 23, 2012 06:41
Diving into erlang
=PROGRESS REPORT==== 23-Jun-2012::00:40:53 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.33.0>},
{name,alarm_handler},
{mfargs,{alarm_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
@darkhelmet
darkhelmet / test.go
Created June 14, 2012 04:44
Example usage of github.com/darkhelmet/twitterstream
package main
import (
"log"
"time"
"github.com/darkhelmet/twitterstream"
)
func decode(conn *twitterstream.Connection) {
for {
@darkhelmet
darkhelmet / quickly.rake
Created June 8, 2012 21:02
Make tests run faster
Rake::TaskManager.class_eval do
def replace_task(old_task, new_task)
@tasks[old_task] = @tasks[new_task]
end
end
desc 'Make tests run faster'
task :quickly do
%w(db:test:load db:test:purge).each do |task|
Rake.application.replace_task(task, 'quickly:nothing')
@darkhelmet
darkhelmet / no-replies.js
Created May 9, 2012 18:01
Filter replies to see what people tweet about
javascript:(function() {
setInterval(function() {
$('#stream-items-id .stream-item:has(.twitter-atreply)').each(function(i, e) {
var $e = $(e);
var firstChild = $($e.find('.js-tweet-text').get(0).childNodes[0]);
if (firstChild.is('a.twitter-atreply')) {
$e.fadeOut(function() {
$(this).remove();
});
}
@darkhelmet
darkhelmet / only-links.js
Created May 9, 2012 17:45
Filter posts without links on Twitter.com
@darkhelmet
darkhelmet / gist:2311981
Created April 5, 2012 15:33
C sizeof operator
To be pedantic, C sizeof doesn't operate on types either. The sizeof
operator applies to an expression or - this is the tricky bit - a type
cast.
thus
sizeof i
but also
sizeof(int)
but not
sizeof int
group :development do
platforms :mri_18 do
gem 'rbx-require-relative', '0.0.9', :require => nil
gem 'linecache', '0.46', :require => nil
gem 'ruby-debug', :require => nil
end
platforms :mri_19 do
gem 'linecache19', '0.5.12', :require => nil
gem 'ruby-debug19', :require => nil
@darkhelmet
darkhelmet / gdb.rb
Created February 28, 2012 20:24
GDB for Homebrew
require 'formula'
class Gdb < Formula
url 'http://ftp.gnu.org/gnu/gdb/gdb-7.4.tar.bz2'
homepage 'http://www.gnu.org/software/gdb/'
md5 '95a9a8305fed4d30a30a6dc28ff9d060'
def install
args = ["--prefix=#{prefix}",
"--disable-debug",
@darkhelmet
darkhelmet / Classifier.hs
Created January 19, 2012 06:11
Number classification in Haskell
data Classification = Perfect | Abundant | Deficient deriving (Eq, Show, Ord)
squareRoot :: Int -> Int
squareRoot = floor . sqrt . fromIntegral
isFactor :: Int -> Int -> Bool
isFactor a b = a `mod` b == 0
factors :: Int -> [Int]
2012-01-18T05:52:24+00:00 app[web.1]: 'dbcore@db7.julep.cloudant.com',<<"heroku/app2359760/make">>,
2012-01-18T05:52:24+00:00 app[web.1]: [1073741824,2147483647],
2012-01-18T05:52:24+00:00 app[web.1]: [{{shard,<<"shards/40000000-7fffffff/heroku/app2359760/make.1326852905">>,
2012-01-18T05:52:24+00:00 app[web.1]: {1,[<<118,22,117,149,21,248,145,241,50,40,154,133,44,231,130,61>>]},
2012-01-18T05:52:24+00:00 app[web.1]: [{doc,<<"bfda8a6a-7239-4108-a570-9f9948de771c">>,
2012-01-18T05:52:24+00:00 app[web.1]: #Ref<0.0.5094.248944>},
2012-01-18T05:52:24+00:00 app[web.1]: {<<"prefix">>,<<"/app/vendor/go">>}]},
2012-01-18T05:52:24+00:00 app[web.1]: {[{<<"command">>,<<"cd src && ./make.bash">>},
2012-01-18T05:52:24+00:00 app[web.1]: [{att,<<"input">>,<<"application/octet-stream">>,undefined,undefined,
2012-01-18T05:52:24+00:00 app[web.1]: <<>>,0,#Fun<fabric_doc_attachments.1.74196499>,identity}],