Skip to content

Instantly share code, notes, and snippets.

@deepfryed
deepfryed / gist:5402046
Last active December 16, 2015 07:58
ui wishlist
  1. watch repos so i can get a news feed but not email spam.
  2. choose repos where i want email notification.
  3. categorize news feeds, so i don't see a long clutter of messages i have to infinite scroll through.
  • i'd like a feed for projects i contribute to, so i know what's going on quickly
  • i'd like a feed for work related (not organizational) repos
  • if feeds are too resource intensive, have an upper limit for free accounts.
  1. get rid of infinite scroll, so i bloody well know which page i'm in.
  2. all feeds should be searchable, come on this is beyond the google age.
  3. fine tune feeds & update feeds when i watch or unwatch repos
@deepfryed
deepfryed / swift_finders.rb
Created February 15, 2013 22:10
simple convenience wrapper
require 'swift'
module Swift
class Record
def self.first options = {}
filter(Filter.filters(options)).first(Filter.constraints(options))
end
def self.all options = {}
@deepfryed
deepfryed / gist:4678040
Created January 30, 2013 22:47
futex_wait on sidekiq
(gdb) bt
#0 0x00007fb39f768d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007fb39feb9c4b in native_cond_wait (mutex=0x2508618, cond=<optimized out>) at thread_pthread.c:305
#2 native_sleep (th=0x2508520, timeout_tv=0x0) at thread_pthread.c:905
#3 0x00007fb39febc38a in sleep_forever (th=0x2508520, deadlockable=0) at thread.c:855
#4 0x00007fb39fe08225 in rb_f_sleep (argc=0, argv=0x7fb39ed1b0c8) at process.c:3469
#5 0x00007fb39feaeac1 in vm_call_cfunc (me=0x2603490, blockptr=0x0, recv=<optimized out>, num=0, reg_cfp=0x7fb39ee1ada8, th=<optimized out>) at vm_insnhelper.c:404
#6 vm_call_method (th=<optimized out>, cfp=0x7fb39ee1ada8, num=<optimized out>, blockptr=0x0, flag=<optimized out>, id=<optimized out>, me=0x2603490, recv=50488680) at vm_insnhelper.c:534
#7 0x00007fb39fea4ea9 in vm_exec_core (th=<optimized out>, initial=<optimized out>) at insns.def:1018
#8 0x00007fb39feaa91a in vm_exec (th=0x2508520) at vm.c:1236
@deepfryed
deepfryed / Gemfile
Created January 16, 2013 10:32 — forked from ronny/Gemfile
source :rubygems
# Turbolinks and jQuery.turbolinks without Rails dependencies
gem 'turbolinks', :git => 'git://github.com/ronny/turbolinks.git', :branch => 'lite'
gem 'jquery-turbolinks', :git => 'git://github.com/ronny/jquery.turbolinks.git', :branch => 'lite'
@deepfryed
deepfryed / migration_bin.rb
Created July 29, 2012 08:14
migrations & hstore support
#!/usr/bin/env ruby
require 'swift'
require 'swift/adapter/postgres'
require 'swift/schema_migration'
require 'fileutils'
require 'optparse'
options = {}
OptionParser.new do |opt|
@deepfryed
deepfryed / adapter_test.rb
Created July 14, 2012 22:00 — forked from jodosha/adapter_test.rb
Quick and dirty porting of RSpec's shared examples to MiniTest.
require 'test_helper'
shared_examples_for 'An Adapter' do
describe '#read' do
before do
@adapter.write(@key = 'whiskey', @value = "Jameson's")
end
it 'reads a given key' do
@adapter.read(@key).must_equal(@value)
#!/usr/bin/env ruby
require 'readline'
require 'redis'
class Redis::Console
def self.start client
new(client).start
end
@deepfryed
deepfryed / uniq_by.rb
Created February 15, 2012 03:17
unique { f(n) | n ϵ N }
module Enumerable
def uniq_by &block
seen = {}
reject {|value| seen.key?(block.call(value)) ? true : seen[block.call(value)] = false}
end
end
@deepfryed
deepfryed / test.rb
Created January 12, 2012 03:44 — forked from tenderlove/test.rb
# encoding: utf-8
require 'rubygems'
require 'benchmark/ips'
require 'set'
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set
def original value
if value.is_a?(String) && value.empty?
@deepfryed
deepfryed / gist:1066972
Created July 6, 2011 10:35
Amazon S3 content type
HTTP/1.0 200 OK
x-amz-id-2: s95X6KRMXeT/gMbMOWU4WFYZMHPZzk/xxY1FDy2aqwb2hiX7rOWdEhcCWTXB4Lek
x-amz-request-id: B7D8B74B02C1D18E
Date: Wed, 06 Jul 2011 07:37:44 GMT
Last-Modified: Sat, 19 Jun 2010 09:28:48 GMT
ETag: "27b5075801658b818f55d521c37a5f4c"
Accept-Ranges: bytes
Content-Type: jpg
Content-Length: 3013
Server: AmazonS3