Public Gists by baroquebobcat

Gravatar
Mon Oct 26 14:42:43 -0700 2009
1
2
3
# I want to be able to check the validity of the parent object
# before saving, and maybe modify it, but I can't use 'before :save'
# because those hooks only run if save_parents is true
Gravatar
Sat Oct 10 15:27:06 -0700 2009
1
2
3
class SomethingAwesome
  include Singleton
  def method_missing method,*args
Gravatar
Thu Oct 08 15:53:27 -0700 2009
1
2
3
=begin
 I was trying to setup some behavior where if
 a new object's parent was not saved, I could
Gravatar
Mon Oct 05 15:44:56 -0700 2009
1
2
3
---
body_id: not_found
title: 404 File Not Found
Gravatar
Sun Oct 04 23:32:32 -0700 2009
1
2
3
# I doubt this even works, I just was looking at Rack::Auth::Digest::MD5
# and realized that you can't use it with the Rack::Builder dsl because it
# needs things set after it has been initialized.
Gravatar
Wed Sep 30 15:25:45 -0700 2009
1
2
3
#!/usr/bin/env ruby
args = ARGV.dup
snark_for_options = {
Gravatar
Wed Sep 30 15:24:18 -0700 2009
1
2
3
class RequireSSL
  def initialize app,options={}
    @app = app
Gravatar
Thu Sep 24 14:27:58 -0700 2009
1
2
3
#This Ugly hack adds Json as one of the types hardcoded to use TEXT.
#
# The problem this solves is this
Gravatar
Tue Sep 22 11:44:19 -0700 2009
1
2
3
require 'openid_provider_sinatra'
 
IDENTITY = OpenStruct.new :login=>'Alice',:password=>'secret',:url=>"http://id.example.com/#{login}"
Gravatar
Wed Sep 16 22:27:55 -0700 2009
1
2
3
require 'openid_provider_sinatra'
 
use Rack::Auth::Basic do |username,password|
Gravatar
Wed Sep 16 22:18:38 -0700 2009
1
2
3
require 'openid_provider_sinatra'
 
use Rack::Auth::Basic do |username,password|
Gravatar
Mon Sep 14 07:06:27 -0700 2009
1
2
3
require 'openid_provider_sinatra'
 
use Rack::Auth::Basic do |username,password|
Gravatar
Thu Sep 10 12:03:03 -0700 2009
1
2
3
# Either datamapper or data objects has some weird behavior on jruby.
# When an empty text field comes before an integer field in a select,
# the integer field is clobbered.
Gravatar
Fri Sep 04 09:10:26 -0700 2009
1
2
3
require 'rubygems'
require 'datamapper'
DataMapper::Logger.new(STDOUT, :debug)
Gravatar
Mon Jul 20 15:46:03 -0700 2009
1
2
3
#fun with jruby dates
#
#perhaps related to
Gravatar
Tue Jun 16 08:19:22 -0700 2009
1
2
3
#way to stop echoing to console while getting a password
#and to do it w/o pulling in another library
#ref: http://www.ruby-forum.com/topic/107442#243864
Gravatar
Tue May 19 14:31:31 -0700 2009
1
2
3
#rails 2.3.2 doesn't like it when cookies are blank, but exist
# this change fixes it.
#Note to self: work up unit tests and do pull request
Gravatar
Tue May 12 22:00:02 -0700 2009
1
2
3
/*
Javascript interface to Twitter search API.
Call it like