Skip to content

Instantly share code, notes, and snippets.

View ChuckJHardySnippets's full-sized avatar

ChuckJHardySnippets

View GitHub Profile
@ChuckJHardySnippets
ChuckJHardySnippets / string_ext.rb
Created March 8, 2012 11:40 — forked from erskingardner/string_ext.rb
Ruby: Convert String to Boolean
class String
def to_bool
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end
@ChuckJHardySnippets
ChuckJHardySnippets / gist:1991859
Created March 7, 2012 08:12
Rails: MySQl Database YML
# MYSQL
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: DBNAME_dev
pool: 5
username: root
password:
socket: /tmp/mysql.sock
@ChuckJHardySnippets
ChuckJHardySnippets / gist:1991853
Created March 7, 2012 08:11
JavaScript: Document Ready
$(function() {
// Handler for .ready() called.
})
$(document).ready(function() {
// Handler for .ready() called.
});
@ChuckJHardySnippets
ChuckJHardySnippets / gist:1991847
Created March 7, 2012 08:10
JavaScript: Starter
$(document).ready(function() {
Review.init();
});
var Review = (function() {
return {
init: function() {
this.preset();
},
preset: function() {