Skip to content

Instantly share code, notes, and snippets.

Jon Kinney jondkinney

Block or report user

Report or block jondkinney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View placeholder_behavior.js
// To get this code to work, simply add a placeholder attribute to any of your inputs.
// This code requires no-conflict jQuery (var $j = jQuery.noConflict();) and Modernizr.
// Also you should add something similar to the following to your stylesheets.
//
// .placeholder{
// color: #666;
// }
jQuery.fn.set_placeholder = function() {
if ($j(this).attr('placeholder') && ($j(this).val() == '' || $j(this).val() == $j(this).attr('placeholder'))) {
@jondkinney
jondkinney / will_paginate_init.rb
Created Apr 19, 2010
Allows will_paginate to work with the row_number function for both normal pagination and when passed custom sql through the paginate_by_sql method
View will_paginate_init.rb
module ActiveRecord
module Associations
module ClassMethods
def construct_finder_sql_for_association_limiting(options, join_dependency)
scope = scope(:find)
# Only join tables referenced in order or conditions since this is particularly slow on the pre-query.
tables_from_conditions = conditions_tables(options)
tables_from_order = order_tables(options)
all_tables = tables_from_conditions + tables_from_order
View will_paginate_by_sql_initializer.rb
#NOTE: jonk (04/14/2010) => monkey patching will_paginate for when paginate_by_sql is specified
require 'will_paginate/core_ext'
module WillPaginate
module Finder
module ClassMethods
def find_table_primary_key_columns(table_name)
@find_table_primary_key_columns_cache ||= {}
if @find_table_primary_key_columns_cache[table_name].nil?
table_name = table_name.split('.').last.delete("[]")
View webrat_open_page.rb
After do |scenario|
if scenario.status == :failed
save_and_open_page
end
end
module Webrat
module SaveAndOpenPage
def save_and_open_page
return unless File.exist?(Webrat.configuration.saved_pages_dir)
@jondkinney
jondkinney / presonus_uc_cleanup
Created Feb 16, 2011
Delete PreSonus UC Files on OS X 10.5 and 10.6
View presonus_uc_cleanup
on run {input, parameters}
-- Setup the list of the main files to be deleted
set searchList to {¬
POSIX file ("/Applications/Universal Control.app") as text, ¬
POSIX file ("/Applications/FireStudio Control Console.app") as text, ¬
POSIX file ("/Applications/FireControl.app") as text, ¬
POSIX file ("/Applications/FireStudio Lightpipe Mixer.app") as text, ¬
POSIX file ("/Applications/StudioLive.app") as text, ¬
POSIX file ("/Library/Application Support/PaeFireStudio") as text, ¬
@jondkinney
jondkinney / gist:828864
Created Feb 16, 2011
PreSonus UC Cleanup
View gist:828864
on run {input, parameters}
-- Setup the list of the main files to be deleted
set searchList to
POSIX file ("/Applications/Universal Control.app") as text, ¬
POSIX file ("/Applications/FireStudio Control Console.app") as text, ¬
POSIX file ("/Applications/FireControl.app") as text, ¬
POSIX file ("/Applications/FireStudio Lightpipe Mixer.app") as text, ¬
POSIX file ("/Applications/StudioLive.app") as text, ¬
POSIX file ("/Library/Application Support/PaeFireStudio") as text, ¬
@jondkinney
jondkinney / README.md
Created May 6, 2011 — forked from napcs/README.md
Deploying Rails to Linode
View README.md

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

@jondkinney
jondkinney / setup_textmate_rails_dev.md
Created Jun 16, 2011
Setup Textmate for Rails Dev on OS X
View setup_textmate_rails_dev.md

##Setup Textmate for Rails Dev on OS X

This guide was written by Jon Kinney for the Green Bay Ruby User Group. Jon works at Intridea and they graciously sponsor the Green Bay RUG meetings.

These guides were also partially completed using time from Intridea's SparkTime initiative which aims to give employees "outside projects" to work on during their normal work week.

If you find any issues with these suggestions please let me know. I've amassed these tips/tricks over several years of full time Rails development using Textmate but just because it works on my system doesn't always mean it will be problem free universally. Thanks to all the blog authors whose articles helped me learn Textmate over the years but whose links/posts I've lost or forgotten over time. If you have a cool Textmate tip or trick please post it in the comments!

View snippet.txt
---
:update_sources: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
:bulk_threshold: 1000
:backtrace: false
:verbose: true
gem: --no-ri --no-rdoc
View snippet.txt
Links:
* How to play with Rails 3.1 and coffeescript now - http://www.rubyinside.com/how-to-rails-3-1-coffeescript-howto-4695.html
* Ordering of asset pipeline - http://stackoverflow.com/questions/6149961/rails-3-1-asset-pipeline-and-manually-ordered-javascript-requires
* Coffeescript TM Bundle - https://github.com/jashkenas/coffee-script-tmbundle
* Remember to run: `osascript -e 'tell app "TextMate" to reload bundles'`
* Use Coffeescript in a Rails 2.3.x application - https://github.com/Sutto/barista
* Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and SimpleForm - https://gist.github.com/989132
* What is autoloading - http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/662abfd1df9b2612?hl=en&pli=1
* Getting started with Factory Girl - https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md
* Rails3 tutorial (best follow along / learning tool period) - http://ruby.railstutorial.org/
You can’t perform that action at this time.