Skip to content

Instantly share code, notes, and snippets.

View btelles's full-sized avatar

Bernie Telles btelles

  • Wing Aviation LLC
  • California, US
  • X @btelles
View GitHub Profile
#
# NOTICE: The stop/restart tasks won't work properly due to a bug in the daemons gem
# unless you use the ghazel-daemons gem by putting this in your environment.rb file:
#
# config.gem "ghazel-daemons", :lib => "daemons"
# gem "ghazel-daemons"
# require "daemons"
#
# This will force-load the 'ghazel-daemons' gem and make sure it's used instead of
# the 'daemons' gem. It works even with the 'daemons' gem installed, so you won't
@btelles
btelles / split_into.rb
Created January 23, 2010 20:01
Split a hash into multiple equal-sized hashes
# Extend hashes by adding one method that allows you to split a hash into an array of equal-sized hashes.
# Filter items to be included in the result by adding a selecting block that returns true
# if the key/value is to be kept.
# Per the usage example, return values are not ordered unless you're using Ruby 1.9
# usage:
# a = {1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd', 5 => 'e'}
# a.split_into(3) {|k,v| k.instance_of?(Integer)}
@btelles
btelles / have_a_line_with_matcher.rb
Created August 8, 2009 20:20
Rspec matcher that tests whether strings exist in a file
class HaveALineWithMatcher
# HaveALineWithMatcher is a simple rspec matcher that tests whether strings exist in a file
#
# = Usage
#
# 1. place this file in your spec/support directory.
#
# 2. use it in your specs:
#
# "/path/to/file".should have_a_line_with "some string"
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132
CmdUtils.CreateCommand(
{
name: "code",
takes: {"function": noun_arb_text},
icon: "http://github.com/fluidicon.png",
homepage: "http://tiago.zusee.com",
author: {name: "Tiago Bastos", email: "comechao@gmail.com"},
license: "MPL,GPL",
description: "Search on Github Code Search",