Skip to content

Instantly share code, notes, and snippets.

Behavior Sanitizers

Mix.install([
  {:kino_db, "~> 0.2.10"},
  {:postgrex, ">= 0.0.0"}
])
@bkerley
bkerley / .gitignore
Last active May 8, 2019 03:06
cxx_goofin
main.dSYM
main
  • 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 January 19, 2016 16:27
my riak time series dev environment
# -*- 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
defmodule Simple do
@doc ~S"""
# Example
iex> Simple.toot()
:toooot
"""
def toot() do
@bkerley
bkerley / pipes.rb
Last active April 8, 2018 02:17
elixir-style function chaining that is also awful!
require 'pp'
class Object
def mutate
Mutagen.new(self)
end
end
class Mutagen < BasicObject
def initialize(collection)
@bkerley
bkerley / find_matches.json
Created February 19, 2015 01:30
kibana queries
{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "kibana.dev"
}
@bkerley
bkerley / crdt_searching.rb
Created February 12, 2015 13:22
RFC: Yokozuna and CRDTs in Ruby
# 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
class Cell
def initialize
become_dead
end
def eigenclass
class << self
self
end
end
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