Skip to content

Instantly share code, notes, and snippets.

Bouke / gist:10454272
Last active Apr 5, 2021
Install FreeTDS, unixODBC and pyodbc on OS X
View gist:10454272

First, install the following libraries:

$ brew install unixodbc
$ brew install freetds --with-unixodbc

FreeTDS should already work now, without configuration:

$ tsql -S [IP or hostname] -U [username] -P [password]
locale is "en_US.UTF-8"
locale charset is "UTF-8"
suryart / application.html.erb
Last active May 19, 2020
Rails 4 flash messages using Twitter Bootstrap(bootstrap-sass: An improved version of
View application.html.erb
// layout file
<div class="container">
<%= flash_messages %>
<%= yield %>
</div><!-- /container -->
maxim /
Last active Feb 25, 2021
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog:

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

ryandotsmith / agg.sql
Created Jan 23, 2013
Postgres array concatenation aggregate function.
View agg.sql
CREATE AGGREGATE array_accum (anyarray)
sfunc = array_cat,
stype = anyarray,
initcond = '{}'
roberto / _flash_messages.html.erb
Created Aug 13, 2012
Rails flash messages using Twitter Bootstrap
View _flash_messages.html.erb
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
<% end %>
simoncoulton / nginx-uwsgi-python3
Created May 7, 2012
Setting up Nginx, uWSGI & Python3
View nginx-uwsgi-python3
Setting up Nginx, uWSGI and Python3
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were:
1) Only showed you how to run the server for a single web application.
2) Only showed you how to configure the app, not the server it was running on.
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me.
ruckus / gist:2293434
Created Apr 3, 2012
Basic setup of WAL-E for continuous archiving and recovery
View gist:2293434

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
View gist:1620128
# [Mon Jan 16 11:23:14 2012] Protocol: http, Server:
curl -XPUT '' -d '
"mappings" : {
"info" : {
"_all" : {
"type" : "string",
"analyzer" : "uax_url_email"
"properties" : {
tankchintan / gist:1335220
Last active Nov 30, 2019
Procedure for installing and setting Sun JDK Java on Default Amazon Linux AMI
View gist:1335220
# First verify the version of Java being used is not SunJSK.
java -version
# Get the latest Sun Java SDK from Oracle
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
# Install Java
wtaysom / where_is.rb
Created Sep 23, 2011
A little Ruby module for finding the source location where class and methods are defined.
View where_is.rb
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
def is_method(klass, method_name)