Skip to content

Instantly share code, notes, and snippets.

View jlindley's full-sized avatar

Jim Lindley jlindley

View GitHub Profile
@jlindley
jlindley / descriptive_sql_load_log.rb
Created July 19, 2011 22:44 — forked from JackDanger/descriptive_sql_load_log.rb
Let Rails display file names and line numbers for log activity.
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
protected
# Turn:
# User Load (6.3ms) SELECT * FROM "users"
# Into:
# User Load /app/views/_partial.erb:27 (6.3ms) in `_app_views_partial_erb` SELECT * FROM "users"
require 'open-uri'
require 'openssl'
req = URI.parse("https://gathercrm.com/internal/auth")
res = req.read(
:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
:http_basic_authentication => ["test", "pass"]
)
@jlindley
jlindley / pre-commit
Created November 11, 2010 22:50 — forked from jhsu/pre-commit
pre-commit hook for git, prevents console.log() statements
#!/bin/sh
# Don't allow console.log() statements to be committed.
#
# Add to .git/hooks/pre-commit
#
# Note: jquery.js seems to always include 1 reference
# in a debugging section, that one can be safely
# ignored. 1 reference to console.log is cool
Do you think it is a good idea to do downcase and a == or is there a better way?
def nbde_new_evaluation_result(nbde_evaluation)
letter = nbde_evaluation.part1_test_result.downcase
if letter == "p"
"Pass"
elsif letter == "f"
"Fail"
else
"Unknown"
require 'rubygems'
# i dunno, what about it?