Skip to content

Instantly share code, notes, and snippets.

View jamiefolsom's full-sized avatar

Jamie Folsom jamiefolsom

View GitHub Profile
@jamiefolsom
jamiefolsom / harvard-marc21-to-elasticsearch.md
Last active January 20, 2021 18:23 — forked from jprante/harvard-marc21-to-elasticsearch.md
Ingest Harvard Library Bibliographic Dataset into Elasticsearch (as raw unmapped MARC21 fields)

HOWTO

Ingest Harvard Library Bibliographic Dataset into Elasticsearch (as raw unmapped MARC21 fields)

This HOWTO is for Linux systems (Windows is very similar)

  • install Java 8 into /usr/java/jdk1.8.0
  • install Elasticsearch 1.1.0
class Membership < ActiveRecord::Base
belongs_to :user
belongs_to :memberable, polymorphic: true
end
module Memberable
extend ActiveSupport::Concern
included do
has_many :memberships, as: :memberable, dependent: :destroy
has_many :users, through: :memberships
@jamiefolsom
jamiefolsom / gist:ce6afa2a1ea7cb8fd691
Created February 29, 2016 21:23 — forked from antoviaque/gist:8423488
Granting superuser privileges to an existing user in edX
edxapp@edx:~/edx-platform$ ./manage.py lms shell --settings=devstack
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

Keybase proof

I hereby claim:

  • I am jamiefolsom on github.
  • I am jamiefolsom (https://keybase.io/jamiefolsom) on keybase.
  • I have a public key whose fingerprint is 3EAA 53C8 B280 50C9 84A1 7617 E76A 89ED 9548 D206

To claim this, I am signing this object:

@jamiefolsom
jamiefolsom / log
Created June 6, 2014 16:08
Log from image migration rake task
============
19263
*******
Existing
Register: 19263
Register image: 40413
Register image filepath: M119_02_R115/M119_02_R115_310v.jpg
Requested orientation: verso
Register image rv flag: v
cfrp_development=# select * from play_ticket_sales order by play_performance_id limit 50;
play_performance_id | seating_capacity | name | title | author | genre | date | total_sold
---------------------+------------------+--------------------+----------------------------------------+----------------------------------------------------------------------------------+----------------+------------+------------
114 | 6 | Premières Loges 1 | Chevalier à la mode (Le) | Dancourt (Florent Carton dit) | comédie | 1778-06-16 | 0
114 | 6 | Premières Loges 2 | Chevalier à la mode (Le) | Dancourt (Florent Carton dit) | comédie | 1778-06-16 | 0
114
@jamiefolsom
jamiefolsom / userAuthorize
Created November 27, 2012 19:24
userAuthorize
userAuthorize: function (action, annotation, user) {
console.info(action);
console.info(annotation);
console.info(user);
switch (action) {
case "read":
var overlap = _.intersection(user.groups,annotation.permissions.read);
if (overlap.length > 0) {
console.info(overlap);
return true;
@jamiefolsom
jamiefolsom / gist:4079755
Created November 15, 2012 16:57
Annotation ranges
[ { "start" : "/div[1]/p[1]", "startOffset" : 25, "end" : "/div[1]/p[1]", "endOffset" : 38, "_id" : { "$oid" : "509a0bf6fdcc6c020000000f" } } ]
[ { "start" : "/div[1]/p[1]", "startOffset" : 40, "end" : "/div[1]/p[1]", "endOffset" : 51, "_id" : { "$oid" : "509a0ce5fdcc6c0200000011" } } ]
[ { "start" : "/div[1]/p[1]", "startOffset" : 55, "end" : "/div[1]/p[1]", "endOffset" : 69, "_id" : { "$oid" : "509a0e31fdcc6c0200000013" } } ]
[ { "start" : "/div[1]/p[20]", "startOffset" : 511, "end" : "/div[1]/p[20]", "endOffset" : 702, "_id" : { "$oid" : "509a0f6dfdcc6c0200000015" } } ]
[ { "start" : "/div[1]/p[11]", "startOffset" : 1059, "end" : "/div[1]/p[11]", "endOffset" : 1158, "_id" : { "$oid" : "509ecdfb23b58f0200000003" } } ]
[ { "start" : "/div[1]/p[12]", "startOffset" : 122, "end" : "/div[1]/p[12]", "endOffset" : 211, "_id" : { "$oid" : "509ecf1a23b58f0200000005" } } ]
[ { "start" : "/div[1]/p[12]", "startOffset" : 595, "end" : "/div[1]/p[12]", "endOffset" : 724, "_id" : { "$oid" : "509ecfb8d3ef590200000003" } }
@jamiefolsom
jamiefolsom / gist:4079751
Created November 15, 2012 16:56
Annotator Exception
n.prototype.setupAnnotation = function(t, n) {
var r, s, o, u, a, f, l, c, h;
n == null && (n = !0), u = this.wrapper[0], t.ranges || (t.ranges = this.selectedRanges), s = [], h = t.ranges;
for (a = 0, l = h.length; a < l; a++) {
o = h[a];
try {
s.push(i.sniff(o).normalize(u))
} catch (p) {
if (!(p instanceof i.RangeError))
throw p;
@jamiefolsom
jamiefolsom / wp-config.php
Created September 14, 2012 21:19 — forked from micahwalter/wp-config.php
wp-config for mamp and phpfog
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the