Skip to content

Instantly share code, notes, and snippets.

View mokolabs's full-sized avatar

Patrick Crowley mokolabs

View GitHub Profile
##
# Calendar helper with proper events
# http://www.cuppadev.co.uk/webdev/making-a-real-calendar-in-rails/
#
# (C) 2009 James S Urquhart (jamesu at gmail dot com)
# Derived from calendar_helper
# (C) Jeremy Voorhis, Geoffrey Grosenbach, Jarkko Laine, Tom Armitage, Bryan Larsen
# Licensed under MIT. http://www.opensource.org/licenses/mit-license.php
##
%p
= link_to header_link_for(:name)
\|
= link_to header_link_for(:location)
\|
= link_to header_link_for(:screens)
def header_link_for(column)
column_name = column.to_s
Socket.gethostname.gsub(/\.local/,'').downcase
def next_meeting(now=1.day.from_now)
if Chronic.parse("1st thursday of this month", :context => :past, :now => now)
return Chronic.parse('1st thursday of next month', :now => now)
else
return Chronic.parse("1st thursday of this month", :now => now)
end
end
Getting this error when using heroku db:pull?
Mysql::Error MySQL server has gone away
The likely culprit is the default value for max_allowed_packet in MySQL on Snow
Leopard. By default this value is only 1M... buy by increasing it to 32M, you can
make this error go away.
To check the value of your max_allowed_packet size, just do this:
var architects = []
$.getJSON("/architects.json", function(data) {
$.each(data.items, function(i,item){
architects.push(item.reverse_name);
});
});
var architects = []
$.getJSON("/architects.json", function(data) {
$.each(data, function(i, item) {
architects.push(item.architect.reverse_name);
});
});
var functions = []
$.getJSON("/functions.json", function(data) {
$.each(data, function(i, item) {
functions.push(item.function.name);
});
$("#functions_list").autocomplete(functions);
});
@mokolabs
mokolabs / clear_log.rb
Created November 16, 2010 04:27
Add this initializer to auto-delete your development log
# Clear logs when booting server locally
# so they don't grow to be 1GB in size
if RAILS_ENV == 'development'
f = File.open("#{RAILS_ROOT}/log/development.log", "w")
f.close
end
.message_block {
clear: both;
margin: 12px 0;
}
.message_block ul {
border-bottom: 1px solid #ecd757;
border-top: 1px solid #ecd757;
list-style: none;
padding: 10px;