Skip to content

Instantly share code, notes, and snippets.

@cjolly
cjolly / test.rb
Created July 21, 2008 22:34
A Test
class Test
def hello
puts "hello fockers"
end
end
@cjolly
cjolly / 12hourTimeSelectRailsHelper.jquery.js
Created April 16, 2010 20:49
jQuery hack for 12 hour datetime selects in rails
function convertDateTimeSelectTo12Hour() {
var translate = {"00":"Midnight","01":"1am","02":"2am","03":"3am","04":"4am","05":"5am","06":"6am","07":"7am","08":"8am","09":"9am","10":"10am","11":"11am","12":"Noon","13":"1pm","14":"2pm","15":"3pm","16":"4pm","17":"5pm","18":"6pm","19":"7pm","20":"8pm","21":"9pm","22":"10pm","23":"11pm"};
$("select[name$='(4i)]'] option").each(function() {
$(this).text(translate[$(this).text()]);
});
}
@cjolly
cjolly / rewrite.rb
Created October 15, 2011 18:22
SEO on Rails or Rack
# As a general rule, I despise all things SEO with it's witchery and voodoo ways.
# However, these two practices are confirmed semi-non-witchcraft SEO best practice.
#
# 1. Serve your content from a consistent domain (www vs. non-www, Doesn't matter. Just be consistent)
# In addition this is nice for Heroku and other cloud based deployment environments that leave your app
# accessible from a url like http://myapp.herokuapp.com
#
# 2. Believe it or not, trailing slashes matter. The google machine interprets http://domain.com/about
# as a different page than domain.com/about/
# (source: http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html )
@cjolly
cjolly / snippet.html
Created November 29, 2011 19:32
TinyMCE Config: Allow Facebook and Google Plus Tags
<div class="social_widgets">&nbsp;<!-- Keep this nbsp; so TinyMCE doesn't consider this div empty -->
<g:plusone size="medium"></g:plusone>
<fb:like layout="button_count"></fb:like>
</div>
@cjolly
cjolly / inline.coffee
Created December 16, 2011 19:55
Toolin around with try-jasmine.heroku.com
$("#edit").live "click", ->
$('.editable').each (i, el) ->
input = $('<input/>',
id: $(el).attr('id') + '_field'
value: $(el).text()
)
$(el).append(input)
@cjolly
cjolly / open_ssl_patch.rb
Created January 23, 2012 15:25
OpenSSL::Buffering monkey patch for handling utf-8 chars in payload
require 'openssl'
raise "Patching OpenSSL::Buffering may not be necessary in ruby #{RUBY_VERSION}p.#{RUBY_PATCHLEVEL}" unless RUBY_VERSION == "1.9.2" && RUBY_PATCHLEVEL == 290
# See this issue for more info.
# http://bugs.ruby-lang.org/issues/5233
module OpenSSL::Buffering
private
##
@cjolly
cjolly / selected_option_text.coffee
Created April 12, 2012 21:43
How to get the text of the selected option with jQuery
$('#select_list_id').live 'change', ->
selectedOptionText = $(this).find("option:selected").text()
@cjolly
cjolly / pg.sh
Last active July 25, 2022 20:16
Use homebrew to upgrade to postgres on OSX
newpg=9.6.1 # set to new PG version number
oldpg=`pg_config --version | cut -d' ' -f2`
# PG 96. upgrades the readline to v7, which breaks anything linked against readline v6, like ruby via ruby-build.
# I *think* this should prevent it from installing v7. But if weird shit happens with various rubies,
# you'll have to reinstall them.
brew pin readline
# Stop current Postgres server
brew services stop postgresql
@cjolly
cjolly / godaddy-heroku-ssl.md
Last active August 6, 2016 21:44
How to use Heroku's SSL Endpoint with an SSL certificate purchased from GoDaddy

[UPDATED FOR #HEARTBLEED]

How to use Heroku's SSL Endpoint with an SSL certificate purchased from GoDaddy.

Heroku's docs on this are now the definitive source. I just followed their instructions to update my apps and they're much better than they were when I made this gist. Here's the previous revision if you need still need it. Good luck!

@cjolly
cjolly / gist:3194351
Created July 28, 2012 18:37 — forked from anonymous/gist:3126700
config
######################################################################
#
# Photoboof Configuration File
#
# Use caution when editing manually.
#
#######################################################################
##################