Skip to content

Instantly share code, notes, and snippets.

View moonglum's full-sized avatar

Lucas Dohmen moonglum

View GitHub Profile
@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 / 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 / Gemfile
Created October 19, 2012 11:06
Potential Subquery Problem
source :rubygems
gem "ashikawa-core", "~> 0.3.0"
@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 / 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 / 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 / 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 / heckle.log
Created May 28, 2012 20:51
Fail Log for Heckle
rm -r coverage
Profiling enabled.
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
@moonglum
moonglum / heckle.log
Created May 28, 2012 19:52
Output of Heckle
rm -r coverage
Profiling enabled.
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
@moonglum
moonglum / .tm_properties
Created May 4, 2012 11:05
My .tm_properties
fontName = "Monaco"
fontSize = 14
softWrap = false
softTabs = true
tabSize = 2
# Add these files to the project view:
myExtraIncludes = ".tm_properties,.gitignore"
fileBrowserGlob = "{*,$myExtraIncludes}"
include = "{$include,$myExtraIncludes}"