Skip to content

Instantly share code, notes, and snippets.

Bryce "BonzoESC" Kerley bkerley

Block or report user

Report or block bkerley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .gitignore
main.dSYM
main
View gist:e9990ce83cf961f37ed3d60326ab8d88
  • 80 grams (about 1 cup whole beans) coffee
  • 2 cups room temperature water

Makes about 3 iced-coffee

  1. Grind beans coarsely, I used one setting below the coarsest. Mix water and coffee into a container, cover, and let sit for 10 hours.
  2. After, filter the brewed coffee as best you can. The result will be strong, too strong to drink. I suggest diluting with 0.5:1.0 water to brew.
  3. Pour over ice, or, heat.
@bkerley
bkerley / Vagrantfile.rb
Created Jan 19, 2016
my riak time series dev environment
View Vagrantfile.rb
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
View simple.ex
defmodule Simple do
@doc ~S"""
# Example
iex> Simple.toot()
:toooot
"""
def toot() do
@bkerley
bkerley / pipes.rb
Last active Apr 8, 2018
elixir-style function chaining that is also awful!
View pipes.rb
require 'pp'
class Object
def mutate
Mutagen.new(self)
end
end
class Mutagen < BasicObject
def initialize(collection)
View find_matches.json
{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "kibana.dev"
}
@bkerley
bkerley / crdt_searching.rb
Created Feb 12, 2015
RFC: Yokozuna and CRDTs in Ruby
View crdt_searching.rb
# the nice thing about this improved yz api is that it's not released yet! i can
# do anything, i'm the master of time!
# this is how we search pretty much anything
query = Riak::Search::Query.new client, index, 'cool search term'
results = query.results # actually hits riak, gives us a ResultsCollection
# existing robject functionality
robject_md = results.docs[0]
# equivalent
View gist:50bbe45972dc85c8436f
class Cell
def initialize
become_dead
end
def eigenclass
class << self
self
end
end
View corpse.rb
def puts(crap); super("stop using puts"); end #dave
def puts(s); super; super("WAT"); (s=s.to_s).reverse!; end # hiro
puts greeting = "Hello Ruby DCamp! It is %s" % Time.now # hiro
puts (words = File.read('/usr/share/dict/words').split).length #bryce
puts (butt_words = words.select {|w| w =~ /butt/}).length #bryce
words = words.select {|w| w =~ /ity$/ } # Jason
words = words.map{|w| w.tr("aeiou", ('a'..'z').to_a.sample(5).join)} # max
puts sentence = (5.times.map{words.sample.reverse}.join " LOL ") # Joshsz
puts upsentence = sentence.upcase # max
new_things = `ls /tmp`; puts new_things # Luqi
View per_class_errors.rb
require 'pry'
module SomeRecord
class Base
def do_something
raise self.class::NotFoundError.new
end
def self.inherited(subclass)
subclass.const_set :NotFoundError, Class.new(SomeRecord::NotFoundError)
You can’t perform that action at this time.