Skip to content

Instantly share code, notes, and snippets.

View nakajima's full-sized avatar
💭
you can have statuses now?

Pat Nakajima nakajima

💭
you can have statuses now?
View GitHub Profile
@JackDanger
JackDanger / descriptive_sql_load_log.rb
Created July 19, 2011 20:24
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"
Gem::Specification.new do |s|
# totally generic
version_file = Dir['lib/*/{*/,}version.rb'].first
s.name = version_file.split('/')[1..-2].join('-')
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.authors = `git shortlog -sn`.scan(/[^\d\s].*/)
s.email = `git shortlog -sne`.scan(/[^<]+@[^>]+/)
s.require_paths = ["lib"]
@technoweenie
technoweenie / gist:975010
Created May 16, 2011 18:25
Response from a support request to the DoD DPS system regarding the inability the login.
Subject: RE: DPS Site Access
No idea what you mean by script information, are you using a Mac? No Mac support for DPS. DPS
requires Windows based systems with Internet Explorer 7 or 8. If you are using IE 8, you will
have to change the zoom level to 150% (bottom right of IE8) from 100% for compatibility reasons.
Remember only IE7 and 8 supported by DPS, No Firefox, Chrome, Safari, and pop up blocker must be
turned off to access DPS and this is listed under TOOLS.
@schacon
schacon / showme
Created February 17, 2011 18:26 — forked from maddox/showme
#!/usr/bin/env ruby
#
# SHOW ME
# Takes X pictures of you via your iSight, animates them, uploads them to CloudApp, and puts
# the url in your clipboard
#
# This uses a bunch of projects to make the magic happen, mostly thanks
# to Zach Holman: http://github.com/holman
#
#
class QueryTracer < ActiveSupport::LogSubscriber
ACCEPT = %r{^(app|config|lib)}.freeze
FRAMES = 5
THRESHOLD = 300 # In ms
def sql(event)
return unless event.duration > THRESHOLD
callers = Rails.
backtrace_cleaner.
@nakajima
nakajima / campfire
Created November 1, 2010 22:36
Lets you post to campfire from the command line. It might already exist.
#!/usr/bin/env ruby
# Usage:
#
# $ campfire "Hello Everyone"
#
# You can also paste
#
# $ campfire -p "some code"
#
# You can also pipe into it
We couldn’t find that file to show.
user.go_to_zoo_and_see_the_penguins_and_get_a_snack_but_get_home_before_seven_because_its_a_school_night_and_hey_awesome_mom_made_brownies_but_theyre_still_cooling_so_we_cant_eat_them_yet_so_lets_watch_some_tv_until_daddy_gets_home_oh_I_think_i_hear_him_and_oh_no_i_think_hes_been_drinking_and_mommy_saw_lipstick_on_his_collar_and_NO_dont_hit_mommy_I_want_to_go_to_my_room_but_I_also_want_brownies
/* Facebook-style buttons by @DHS */
.inputbutton {
background: #3b5998;
color: white;
padding: 2px 18px 3px 18px;
border-top: 1px white solid;
border-left: 1px white solid;
border-right: 1px #000033 solid;
border-bottom: 1px #000033 solid;
class Intercession
# Duh.
VERSION = "3.0.0"
def initialize app, behavior
@app = app
@behavior = behavior
@after = @behavior.instance_methods.map(&:to_s).include? "after"
end