Skip to content

Instantly share code, notes, and snippets.

View metaskills's full-sized avatar
🐙
Being Inkcellent to Each Other

Ken Collins metaskills

🐙
Being Inkcellent to Each Other
View GitHub Profile
[alias]
co = checkout
put = push origin HEAD
# 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])
/* 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 (authors.name = 'David')
GROUP BY [posts].id
ORDER BY MIN(UPPER(posts.title)), MIN(posts.id)
#! /usr/bin/env ruby
require 'time'
puts "starting fibonacci"
def fib(num)
if(num < 2)
return 1
else
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:
(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
a = if foo = nil # !> found = in conditional, should be ==
'bar'
else
'none'
end
a # => "none"
#!/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']
#!/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`
end
module VersionedExtensions
def save_version?
false
end
def set_version(v)
self.version = v
update_without_callbacks
end