Skip to content

Instantly share code, notes, and snippets.

mayo /
Last active August 29, 2015 14:01
Dayselect Scale

Expanding on mbostock's weekday.js and my Weekdays gists by adding adaptive tick mark format and wrapping it all up in a dayselect scale (d3.scale.dayselect).

View at;

mayo / Import.lua
Created October 25, 2014 17:45
This patch should not be required to import your Aperture library into Lightroom, and I don’t recommend using it. I wrote it when I was having problems with the import, but have since found the source of the problems fixable within the Aperture library. Please see my updated blog post at This g…
--- Import.lua.orig 2014-10-25 10:13:07.000000000 -0700
+++ Import.lua 2014-10-25 10:41:34.000000000 -0700
@@ -154,15 +154,15 @@
local kwdInf, outputPath, err = Utils.getKeywordInfo( aperturePkg, workDir )
- if props.importOnlyUsedKeywords then
+ if props.importOnlyUsedKeywords and kwdInf then
for i, root in ipairs( kwdInf.keywords ) do
dropUnusedKeywords( root, kwdInf.keywords, i, kwdInf.usedKeywords )
### Keybase proof
I hereby claim:
* I am mayo on github.
* I am mayo ( on keybase.
* I have a public key whose fingerprint is 50FE C3A3 64B5 9BEE 734D 0E9B 56A3 789C ED4D 2DD7
To claim this, I am signing this object:
mayo / gist:11624
Created September 19, 2008 17:40 — forked from cilquirm/gist:11623
module MarcasDeTiempo
def self.included(base)
# Propiedades especiales
# Permite guardar la fecha y hora de eliminación del recurso
property :deleted_at, ParanoidDateTime
# Permite conocer cuándo fue creado y cuándo fue modificado el recurso
property :created_at, DateTime
property :updated_at, DateTime
have_header: checking for win32.h... -------------------- no
"mingw32-gcc -E -I. -I/usr/home/mayo/.rake-compiler/ruby/ruby-1.8.6-p287/lib/ruby/1.8/i386-mingw32 -I/usr/home/mayo/do/do_postgres/ext/do_postgres_ext -I/usr/home/mayo/do/cross/postgres-8_2_11/pgsql/include/server/port/win32 -I/usr/home/mayo/do/cross/postgres-8_2_11/pgsql/include -g -O2 conftest.c -o conftest.i"
conftest.c:1:19: error: win32.h: No such file or directory
checked program was:
/* begin */
1: #include <win32.h>
/* end */
#include <libpq-fe.h>
#include <postgres.h>
#include <mb/pg_wchar.h>
#include <catalog/pg_type.h>
/* Undefine constants Postgres also defines */
Luis@KEORE (D:\Users\Luis\projects\oss\datamapper\do.git\do_postgres\ext\do_postgres_ext)
$ ruby extconf.rb --with-pgsql-dir=d:/users/luis/projects/oss/_libs/pgsql --with-pgsql-server-include=D:/users/luis/projects/oss/_libs/pgsql/include/server --with-pgsql-win32-include=d:/users/luis/projects/oss/_libs/pgsql/include/server/port/win32
require 'rubygems'
require 'dm-core'
require 'dm-serializer'
class Test
include DataMapper::Resource
property :id, Serial
class User
require DataMapper::Resource
property :id, Serial
property :...
has n, :interests
has n, :questions, :through => :interests
b = Book.get(1)
b.latest_page #=> yields Page with id 3, as if I did Page.first(:order => [ :book_id.desc ])
#if I replace the line in latest_page with
self.pages.first(:book_id =>, :order => [ :created_at.desc ])
b.latest_page #=> yields Page with id 2, as expected
#if I replace the line in latest_page with