Skip to content

Instantly share code, notes, and snippets.

View moonglum's full-sized avatar

Lucas Dohmen moonglum

View GitHub Profile
@moonglum
moonglum / 1.2.2-output.log
Created June 10, 2012 15:09
Heckle with different ruby2ruby versions
☹ bundle update
Fetching gem metadata from http://rubygems.org/.......
Using ZenTest (4.8.1)
Using RubyInline (3.9.0)
Using sexp_processor (3.2.0)
Using ParseTree (3.0.9)
Using ruby2ruby (1.2.2)
Using heckle (1.4.3)
Using bundler (1.1.4)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
@moonglum
moonglum / ruby_rogues_40.md
Created July 24, 2012 20:19
Ruby Rogues 40 - Text Editors and IDEs

These are notes I have taken while listening to episode 40 of the Ruby Rogues. If you find a mistake, please feel free to send me a pull request.

Panel

  • James Edward Gray II: Uses TextMate. Teaches himself emacs.
  • Avdi Grimm: emacs
  • David Brady: emacs
  • Gary Bernhardt: vim
  • Josh Susser: TextMate
  • Charles Max Wood: vim
@moonglum
moonglum / notes.mdown
Created August 3, 2012 20:21
Notes on: Building a Ruby Library, the Parts No One Talks About

Notes on: Building a Ruby Library, the Parts No One Talks About

by Mitchell Hashimoto at Euruko 2012 and the according Video

  • Idiomatic Ruby: Don't try to be cool
  • Configurable
    • Plain old Ruby – config should have NO MAGIC
    • Central configuration – keep it in one place
    • Mylib.configure do |config|
  • Instance configuration via option hash
@moonglum
moonglum / top.rb
Created August 18, 2012 11:33
`Top -p <PID> -b` Parser
#! /usr/bin/env ruby
## Parses results from:
# `top -p <PID> -b`
start = 0
File.read(ARGV[0]).each_line do |line|
if line.match(/^\d+/)
parsed = line.split
cpu = parsed[2]
@moonglum
moonglum / Gemfile
Created October 19, 2012 11:06
Potential Subquery Problem
source :rubygems
gem "ashikawa-core", "~> 0.3.0"
@moonglum
moonglum / ashikawa.rb
Created November 17, 2012 09:33
A small example for Arrays in Ashikawa::AR
require "ashikawa-ar"
Ashikawa::AR.setup :default, "127.0.0.1:8529"
class MyFineModel
include Ashikawa::AR::Model
attribute :name
# This is where the magic happens!
attribute :my_strings, Array[String]
@moonglum
moonglum / mongo_visitor.rb
Created November 24, 2012 14:33
I don't really understand this behavior
relation = base_relation.restrict do |r|
r.name.eq "Cologne"
end.sort_by do |r|
[ r.name, r.country ]
end
mongo_visitor = Veritas::Adapter::Mongo::Visitor.new relation
p mongo_visitor.query
#=> {:name=>"Cologne"}
@moonglum
moonglum / CommonRescue.rb
Last active December 14, 2015 05:40
A question of taste...
# Imagine you need to "translate" certain exceptions in a
# wrapper around an external library.
# These exceptions can occur in multiple methods, so you
# want to reuse the translation mechanism.
#
# How do you do it? I came up with two solutions:
# 1. Solution: The Bubblewrap
def get_request(params)
bubblewrap_request do
require "ashikawa-core"
db = Ashikawa::Core::Database.new do |config|
config.url = "http://localhost:8529"
end
collection = db["documenttests"]
document = collection.create_document(:name => "The Dude")
document_key = document.key
@moonglum
moonglum / media-center.md
Created October 6, 2013 08:15
Ok, Nerds. I need some help here.

Media Center

Given I have a Beamer and a Soundbar and I would want to watch movies from an external HDD, the web (Flash + HTML5) and BluRay/DVD. Plus would be Airplay Mirroring, but it's not necessary.

I want to choose the core of this media center. What would you choose? Why?