Skip to content

Instantly share code, notes, and snippets.

Being Inkcellent to Each Other

Ken Collins metaskills

Being Inkcellent to Each Other
View GitHub Profile
View .gitconfig
co = checkout
put = push origin HEAD
View gist:24073
# Debugging limiting association joins for SQL Server Adapter.
Giving the following limiting SQL that would be normaly be generatd for the
test_eager_load_has_many_through_has_many(AssociationsJoinModelTest) case in
ActiveRecord for SQL Server. In this case the ORDER BY is totally moot.
SELECT DISTINCT TOP 1 [authors].id
FROM [authors]
LEFT OUTER JOIN [posts] ON ([authors].[id] = [posts].[author_id])
LEFT OUTER JOIN [comments] ON ([comments].[post_id] = [posts].[id])
View gist:25118
/* Here is the start of the assocaiation limiting SQL before needing limit/offset */
SELECT [posts].id
FROM [posts]
LEFT OUTER JOIN [authors] ON [authors].id = [posts].author_id
WHERE ( = 'David')
GROUP BY [posts].id
ORDER BY MIN(UPPER(posts.title)), MIN(
View gist:47697
#! /usr/bin/env ruby
require 'time'
puts "starting fibonacci"
def fib(num)
if(num < 2)
return 1
View gist:50027
require 'yaml'
# When this file is loaded, for each data fixture file, a module is created within the DataFixtures module
# with the same name as the fixture file. For each fixture in that fixture file, a singleton method is
# added to the module with the name of the given fixture, returning the value of the fixture.
# For example:
# A fixture in <tt>int_live_data.yml</tt> named <tt>fix1_response_for_get_vin_parts</tt> with value
# <tt><foo>hi!</foo></tt> would be made available like so:
View gist:50721
(kencollins@station) - (~) Misc
-=>> sudo gem install rails-sqlserver-2000-2005-adapter
Successfully installed rails-sqlserver-2000-2005-adapter-2.2.9
1 gem installed
Installing ri documentation for rails-sqlserver-2000-2005-adapter-2.2.9...
Installing RDoc documentation for rails-sqlserver-2000-2005-adapter-2.2.9...
(kencollins@station) - (~) Misc
-=>> sudo gem install rails-sqlserver-2000-2005-adapter
View gist:53820
a = if foo = nil # !> found = in conditional, should be ==
a # => "none"
View gist:55952
#!/usr/bin/env ruby
# Subversion Fame Report
# List the user and their number of commits.
require 'rubygems'
require 'activesupport'
log_xml = `svn log -q --xml`
svn_logs = XmlSimple.xml_in(log_xml)['logentry']
View sweat.rb
#!/usr/bin/env ruby
APPS = ['Address Book','Calculator','Dictionary','DVD Player','Font Book','iCal','QuickTime Player','Safari']
UTILS = ['Activity Monitor','Console','Disk Utility','Network Utility']
def launch_app(app)
puts "Launch: #{app}"
`open /Applications/#{app.sub(' ','\ ')}.app`
View gist:61010
module VersionedExtensions
def save_version?
def set_version(v)
self.version = v
You can’t perform that action at this time.