Skip to content

Instantly share code, notes, and snippets.

View bkeepers's full-sized avatar

Brandon Keepers bkeepers

View GitHub Profile
def slow_each(options, &block)
0.step(count(options), options[:limit]) do |offset|
find(:all, options.merge(:offset => offset)).each(&block)
end
end

Keybase proof

I hereby claim:

  • I am bkeepers on github.
  • I am bkeepers (https://keybase.io/bkeepers) on keybase.
  • I have a public key whose fingerprint is 8AF6 4385 E45B 03AA 72D7 DE72 F524 D391 D545 3EF9

To claim this, I am signing this object:

@bkeepers
bkeepers / twitnoise
Created June 3, 2014 12:29
Signal & Noise lists on Twitter
#!/bin/bash
#
# This script encapsulates my process for keeping up with Twitter:
#
# 1. Create a private list called Signal, add everyone you currently follow to
# it, and begin curating it.
# 2. Follow everyone you meet or find interesting.
# 3. Create a private list called Noise, containing everyone you follow that are
# not in Signal.
# 4. Use Signal as your timeline in tweetbot. Switch to Noise when you are bored
@bkeepers
bkeepers / dabblet.css
Created September 15, 2014 03:43
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;

Issue and Pull Request Age

@bkeepers
bkeepers / modelines.rb
Last active August 29, 2015 14:14
Regular expression for vim and emacs modelines.
/
(?:
(-\*- \s* (?:mode:)? \s*) | # $1: Emacs
(\/\* \s* vim: \s* set \s* (?:ft|filetype)=) # $2: Vim
)
(\w+) # $3: language
(?:
(?(1) # If $1 matched...
;?\s* -\*- | # then close Emacs syntax
: \s* \*\/ # otherwise close Vim syntax
def test_invalidate_tree
r1 = Category.create
r2 = Category.create
r3 = Category.create
r4 = Category.create
nodes = [r1, r2, r3, r4]
r2.move_to_child_of(r1)
nodes.each(&:reload)
assert Category.valid?
>> require 'org-ruby'
>> puts Orgmode::Parser.new(File.read('/tmp/test.org')).to_html
<ul>
<li>Item 1</li>
<li>Item 2
<pre class="example">
Example
Example
Example
</pre>