Skip to content

Instantly share code, notes, and snippets.

View jroes's full-sized avatar

Jon Roes jroes

  • Streamlit
  • Charlotte, NC
  • X @jroes
View GitHub Profile
@jroes
jroes / gist:4596405
Last active December 11, 2015 11:48
jroes work$ rhc app create -a railsapp2 -t ruby-1.9 && rhc cartridge add -a railsapp2 -c mysql-5.1 && cd railsapp2 && git remote add upstream -m master git://github.com/openshift/rails-example.git && git pull -s recursive -X theirs upstream master
Password: **************
Creating application 'railsapp2'
================================
Namespace: skookum
Cartridge: ruby-1.9
Gear Size: default
Scaling: no
GIT
remote: git://github.com/spree/spree-multi-domain
revision: 9b2e7c71f62fc514d8624515a168c44c5353208c
specs:
spree_multi_domain (1.0.0)
spree_core (~> 1.2)
GIT
remote: git://github.com/spree/spree_auth_devise
revision: 887dba92d5075550b38e947ddd5bfa384932c942
module ActiveAdmin
class FormBuilder < ::Formtastic::FormBuilder
# ...
# The input method returns a properly formatted string for
# its contents, so we want to skip the internal buffering
# while building up its contents
def input(method, *args)
content = with_new_form_buffer { super }
return content.html_safe unless @inputs_with_block
var mongoose = require('./../mongoose');
console.error(
'\n==========='
, ' mongoose version: '
, mongoose.version
, '========\n\n'
);
var Schema = mongoose.Schema;
-module(bot).
-author("jonathan.roes@gmail.com").
-export([connect/2, loop/1]).
-define(nickname, "jroes-test").
-define(channel, "#jroes-test").
% Connect to an IRC server with a given Host and Port. Set up the TCP option to
% give us messages on a line-by-line basis.
connect(Host, Port) ->
{ok, Sock} = gen_tcp:connect(Host, Port, [{packet, line}]),
@jroes
jroes / gist:1987346
Created March 6, 2012 16:38
Play Warcraft 2 "work complete" sound with shell alias `beep`
#!/bin/bash
#
# Adds a shell alias `beep` that plays the "Work Complete!" sound from Warcraft 2 on OSX via afplay.
#
# Just add `&& beep` to the end of any long-running CLI process. Useful if you aren't a Growl user.
#
# rake db:reset && rake db:test:prepare && beep # => You'll hear "Work Complete!" when it's done.
#
# Jon Roes <jroes@jroes.net>
When /^I fill in "([^\"]*)" within "([^\"]*)" with "([^\"]*)"$/ do |field, parent, value|
within(parent) do
fill_in(field, :with => value)
end
end
irb(main):010:0> @trip.stops
~ (0.000097) SELECT "id", "trip_id", "place_id" FROM "stops" WHERE "trip_id" = 19 ORDER BY "id"
=> [#<Stop @id=28 @trip_id=19 @place_id=28>, #<Stop @id=29 @trip_id=19 @place_id=29>, #<Stop @id=30 @trip_id=19 @place_id=30>]
irb(main):011:0> @trip.stops[-1..1]
=> []
#expected last 2:
=> [#<Stop @id=29 @trip_id=19 @place_id=29>, #<Stop @id=30 @trip_id=19 @place_id=30>]
@jroes
jroes / rbl.rb
Created October 16, 2009 14:36 — forked from anonymous/rbl.rb
require 'rubygems'
require 'net/dns/resolver'
DEFAULT_SERVERS = [ 'dnsbl.ahbl.org' ]
module Rack
class RBL
# List of RBL servers to check against
attr_accessor :servers
class Object
def method(m)
`grep -Rn "def #{m}" .`
end
def classmethod(m)
`grep -Rn "def self.#{m}" .`
end
end