Skip to content

Instantly share code, notes, and snippets.

@ionas
ionas / POSTGRESQL_ON_OS_X.md
Created June 4, 2012 16:45 — forked from mbbx6spp/POSTGRESQL_ON_OS_X.md
Homebrew Postgresql on OS X though only tested myself on Lion (10.7.4)

PostgreSQL on Lion

Much to my dismay, PostgreSQL on OS X is not as trouble-free to install and configure as my experiences with it on a variety of Linux distributions. This Gist documents how to overcome these issues using the Homebrew installation of postgresql.

This is an effort to document how to get setup to a coworker who was having troubles with Postgres on Lion recently.

Installation

This is usually the easy part:

@ionas
ionas / google_art_project.rb
Created January 13, 2012 01:41 — forked from henrik/google_art_project.rb
Google Art Project fullsize image downloader. Specify the page URL and the tiles are downloaded, stitched and trimmed.
# Google Art Project fullsize image downloader.
# By Henrik Nyh <http://henrik.nyh.se> 2011-02-05 under the MIT license.
# Requires Ruby and ImageMagick.
#
# Usage e.g.:
# ruby google_art_project.rb http://www.googleartproject.com/museums/tate/portrait-of-william-style-of-langley-174
#
# You can specify multiple URLs on the command line, separated by space.
# Or you can specify no URLs on the command line and instead list them at the end of this file, one on each line,
# with "__END__" before the list.
@ionas
ionas / fuse_wait.c
Created December 27, 2011 15:25 — forked from bfleischer/build.sh
Workaround for NTFS-3G and Lion's CoreFoundation bug
/*-
* fuse_wait - Light wrapper around a FUSE mount program that waits
* for the "mounted" notification before exiting.
*
* Copyright (C) 2007-2009 Erik Larsson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@ionas
ionas / application.js
Created December 28, 2010 18:24
reduced functionality of: https://gist.github.com/755139
$(function() {
$('#products_search input').keyup(function() {
$.bbq.pushState($('#products_search').serialize() + '&page=1');
}, 250);
});
$('#products th a, #products .pagination a').live('click', function(e) {
e.preventDefault();
$.bbq.pushState($.param.querystring(this.href));
});
$(window).bind('hashchange', function() {
#http://stackoverflow.com/questions/373731/override-activerecord-attribute-methods
def price(option = nil)
if option == :nice
("%.2f" % price).gsub('.00', '.--').gsub('.', ',')
else
read_attribute(:price) # No test for nil?
end
end
@ionas
ionas / product.rb
Created December 27, 2010 18:49
Call via Product.labels(:price)
# TODO: do label translation here as well.
@@labels = {
:price => 'Price incl. VAT'
}
def self.labels(attribute_name)
if @@labels[attribute_name]
@@labels[attribute_name]
else
attribute_name.to_s.titleize
end
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(function() {
// Hide the form button
$('#products_search input[type="submit"]').hide();
// Push searches onto the location hash
var inputTimeoutId = -1;
# index.js.erb:
$("#products").html(
"<%= escape_javascript(render('products')) %>"
);
$("#products_search_hidden_fields").html(
"<%= escape_javascript(render('products_search_hidden_fields')) %>"
);
# index.html.erb:
<%= form_tag products_path, :method => 'get', :id => "products_search" do %>
@ionas
ionas / rails bookmark
Created December 25, 2010 02:47
rails bookmark
http://railstrip.ourgreatjourney.com/how-to-paginate-sort-and-search-a-table-with-ajax-and-rails-jquery-style/
http://thechangelog.com/post/1121940971/terminitor-automate-your-workflow