Skip to content

Instantly share code, notes, and snippets.

View objo's full-sized avatar

Joe O'Brien objo

View GitHub Profile
require 'logger'
$log = Logger.new(File.join(File.dirname(__FILE__), '..', 'log', 'nwms.log'))
$log.formatter = Logger::Formatter.new
$log.datetime_format = "%Y-%m-%d"
class Object
def log
$log
end
entries.map(&:job).sort{|x,y| x.number <=> y.number}.map(&:project).compact.uniq
require 'logger'
class Object
def start_logger
env_type = ENV["LOG"] ||= "DEBUG"
if env_type == "PDM"
init_log(STDOUT, Logger::INFO)
else
level = eval("Logger::#{env_type.gsub('SCREEN_','')}")
if env_type.index("SCREEN_")
# set these environment variables on your prod server
production:
<<: *defaults
host: <%= ENV['MONGOID_HOST'] %>
port: <%= ENV['MONGOID_PORT'] %>
database: <%= ENV['MONGOID_DATABASE'] %>
package org.me;
public class Baz {
public void call(){
System.out.println("I'm here");
}
}
[objo-laptop | haggis-head-pindah ] $ mirah src/org/edgecase/haggishead/throw_away.mirah
src/org/edgecase/haggishead/throw_away.mirah:2: super: no superclass method `infer'
def self.look_natural(state, &block)
^^^^^^
/Users/objo/.rvm/gems/jruby-1.6.0.RC2@pindah/gems/mirah-0.0.6.dev-java/lib/mirah/ast/method.rb:194:in `infer': super: no superclass method `infer' (Mirah::InternalCompilerError)
from /Users/objo/.rvm/gems/jruby-1.6.0.RC2@pindah/gems/mirah-0.0.6.dev-java/lib/mirah/typer.rb:295:in `infer'
from /Users/objo/.rvm/gems/jruby-1.6.0.RC2@pindah/gems/mirah-0.0.6.dev-java/lib/mirah/ast/method.rb:30:in `infer'
from org/jruby/RubyArray.java:2458:in `collect'
from /Users/objo/.rvm/gems/jruby-1.6.0.RC2@pindah/gems/mirah-0.0.6.dev-java/lib/mirah/ast/method.rb:30:in `infer'
from /Users/objo/.rvm/gems/jruby-1.6.0.RC2@pindah/gems/mirah-0.0.6.dev-java/lib/mirah/typer.rb:295:in `infer'
@objo
objo / gist:3003893
Created June 27, 2012 12:50
Money for Charity

Scottish Ruby Conference has always stepped up to raise money for an incredible charity, [CHAS] (http://www.justgiving.com/src2012). In the past the amounts raised have been astounding. I dare you to read about CHAS with dry eyes.

How do they raise the money? Simply asking people to donate in order to register for a tutorial the day before the conference (a practice started by Dave Thomas and Mike Clark doing a Rails Guidebook in 2006). So instead of taking in revenue for something like training, they opt to pass it along to a charity that helps families in their most critical time of need.

This year, the amount raised has been meager. As it stands now, we've only managed to get to just under £4,900. We can do much better. My hypothesis is that the reason we have not raised more is that people this year are not as interested in the tutorials, not that we are less generous than years past. Just because you are not attending a tutorial it doesn't mean you can't or shouldn't donate.

Just because you could

@objo
objo / phantom-script.js
Last active January 26, 2017 19:51
Not finding mySelector variable.
var system = require('system');
var args = system.args;
var page = require('webpage').create();
mySelector = args[1];
system.stdout.write(mySelector);
page.open('http://phantomjs.org', function() {
var elementValue = page.evaluate(function(mySelector) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Travel Site</title>
<link rel="stylesheet" href="assets/stylesheets/site.css">
<link href="https://fonts.googleapis.com/css?family=Luckiest+Guy" rel="stylesheet">
</head>
<body>

Keybase proof

I hereby claim:

  • I am objo on github.
  • I am objo (https://keybase.io/objo) on keybase.
  • I have a public key ASBd7JEBGXh8LeiZL7stJWe7S6BExy8T17VIk_HbA0z0YAo

To claim this, I am signing this object: