Skip to content

Instantly share code, notes, and snippets.

@goldsmith
goldsmith / numpy_os_x_10_9.sh
Last active January 6, 2024 07:25
How to install Numpy and Scipy on Mac OS X Mavericks (10.9) using Pip.
# set up flags for Numpy C extentions compiling
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
export CC=gcc-4.2
export CXX="g++ -arch i386 -arch x86_64"
pip install numpy
# success!
@ebeigarts
ebeigarts / RAILS_RELATIVE_URL_ROOT.md
Last active February 2, 2023 15:16
RAILS_RELATIVE_URL_ROOT

RAILS_RELATIVE_URL_ROOT

Rails

By default RAILS_RELATIVE_URL_ROOT is used only for asset pipeline.

To namespace your rails routes you need to wrap run MyApp::Application with map in your config.ru:

map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@cspanring
cspanring / tastyhacks.py
Created February 8, 2012 18:25
Add GeoJSON support for geometry fields in django-tastypie
# Shamelessly stolen from https://github.com/newsapps/django-boundaryservice/blob/master/boundaryservice/tastyhacks.py
from django.contrib.gis.db.models import GeometryField
from django.utils import simplejson
from tastypie.bundle import Bundle
from tastypie.fields import ApiField, CharField
from tastypie.resources import ModelResource
@myersjustinc
myersjustinc / countyFIPS.js
Created September 21, 2011 21:55
Mappings between five-digit county FIPS codes and their corresponding counties
// Source: http://www.census.gov/geo/www/ansi/countylookup.html
var countyToFIPS = {
'Alabama': {
'Autauga County': '01001',
'Baldwin County': '01003',
'Barbour County': '01005',
'Bibb County': '01007',
'Blount County': '01009',
'Bullock County': '01011',
@gunn
gunn / _form_carrier_wave_file.html.haml
Created March 24, 2011 10:14
Carrierwave support for rails_admin
= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label
.input
- if field.bindings[:object].send("#{field.name}_url")
.row
= link_to field.bindings[:object].send("#{field.name}_url")
%br
= form.check_box "remove_#{field.name}"
= form.label "remove_#{field.name}", "Remove existing #{field.label.downcase}", class: "inline"
.row
= form.file_field field.name, class: "fileUploadField #{field.has_errors? ? "errorField" : nil}"