Skip to content

Instantly share code, notes, and snippets.

View bjeanes's full-sized avatar
🕊️

Bo Jeanes bjeanes

🕊️
View GitHub Profile
-- I spent all of yesterday re-writing queries for a government project
-- because their production database runs MySQL v3 and they won't upgrade.
-- MySQL 3 sucks and doesn't even support sub-queries. This is an example of
-- how I wasted what little time I have left:
-- The original:
SELECT p1. * , (
SELECT COUNT( `id` )
FROM `pages` p2
@bjeanes
bjeanes / environment.rb
Created October 1, 2008 02:18 — forked from mislav/_note.md
PostgreSQL version of GitConf to manage branched databases
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
require 'git_conf'
Rails::Initializer.run(:process, GitConf.new) do |config|
# ...
end
# Oh. My. God. Love.
alias my_server='screen -R -d -m -S my_server ssh my_user@my.server'
# With aliases like this in my .bashrc I can just type `my_server` into any terminal and be presented
# with that server connection. With enough aliases like this it means that from any terminal, I can just
# type `my_server` again and it will disconnect that session from the other window and into my current one.
# screen(1) kicks. ass.
Bos-MacBook-Pro:integrity bjeanes (master)$ rake
(in /Users/bjeanes/Projects/Clones/integrity)
rm -r coverage
Loaded suite /usr/bin/rcov
Started
..................................E.......
Finished in 3.123474 seconds.
1) Error:
test_project_when_building_a_build_sends_notifications_with_all_registered_notifiers(Test::Unit::TestCase::TestProject20863500::TestWhenBuildingABuild20844450):
abstract (1.0.0)
actionmailer (2.2.2, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 1.3.6)
actionpack (2.2.2, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.2.2, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 1.15.6)
activeresource (2.2.2, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4)
activesupport (2.2.2, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 1.4.4)
acts_as_ferret (0.4.1)
addressable (2.0.1, 2.0.0, 1.0.4)
alter-ego (1.0.0)
@bjeanes
bjeanes / gist:38889
Created December 22, 2008 04:41 — forked from drnic/gist:38843
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
<VirtualHost *:80>
ServerName mingle.mocra.com
ServerAlias elevensoftmingle.selfip.com
ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
module BlahPlugin
VERSION = '1.0.0'
class << self
# add plugin to AR only if it hasn't been included before,
# which may cause stack-level-too-deep errors if you're aliasing methods
#
def enable_activerecord
return if ActiveRecord::Base.respond_to? :acts_as_blah
ActiveRecord::Base.extend BlahPlugin::Macro
@bjeanes
bjeanes / snippet.sh
Created January 16, 2009 23:29 — forked from drnic/snippet.sh
function parse_git_deleted {
[[ $(git status | grep deleted:) != "" ]] && echo "-"
}
function parse_git_added {
[[ $(git status | grep "Untracked files:") != "" ]] && echo '+'
}
function parse_git_modified {
[[ $(git status | grep modified:) != "" ]] && echo "*"
}
function parse_git_dirty {
(1..1325).to_a.each do |num|
link = "http://www.questionablecontent.net/comics/#{num}.png"
`curl #{link} > ~/Pictures/QC/#{num}.png &2>1`
puts "#{num} downloaded..."
end