This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$map = array( | |
'jpeg' => 'islandora:sp_basic_image', | |
'jpe' => 'islandora:sp_basic_image', | |
'jpeg' => 'islandora:sp_basic_image', | |
'gif' => 'islandora:sp_basic_image', | |
'png' => 'islandora:sp_basic_image', | |
'tif' => 'islandora:sp_large_image_cmodel', | |
'tiff' => 'islandora:sp_large_image_cmodel', | |
'jp2' => 'islandora:sp_large_image_cmodel', | |
'pdf' => 'islandora:sp_pdf', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function click(d) { | |
if (!d.children && !d._children) | |
{ | |
d3.json("http://xxxx:2222/getChildNodes", function(error,response) { | |
response.children.forEach(function(child){ | |
if (!tree.nodes(d)[0]._children){ | |
tree.nodes(d)[0]._children = []; | |
} | |
child.x = d.x0; | |
child.y = d.y0; |
This example pulls together various examples of work with trees in D3.js.
The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.
One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.
Dragging can be performed on any node other than root (flare). Dropping can be done on any node.
Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Make A-Z do rank sorting*/ | |
if($('body').hasClass('EXLAlmaAz')) | |
{ | |
$input = $("#exlidSearchRibbon input[name='fn']"); | |
if($input.val() =='goAlmaAz') | |
{ | |
$input.after('<input type="hidden" name="sortField" value="rank">'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
"use strict"; | |
//dynamically add a Google Event tracking event to a CDM download button | |
//make sure that Google Analytics is loaded | |
if (_gaq) { | |
var sizes, p, url, item_id, title_div, item_title, dlb; | |
//define download buttons for loop below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecs | |
import csv | |
import datetime | |
import pycdm | |
from HTMLParser import HTMLParser | |
#get input: alias + items to retrieve | |
alias = raw_input('collection alias: ') | |
items = raw_input('item identifiers (separate by commas): ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Script to get scaled image URL from CONTENTdm reference URL | |
* Phil Sager <[email protected]>. | |
* | |
*/ | |
$CDM_WEBSERVICES_HOME = "https://somedomain.contentdm.oclc.org"; // web services | |
$CONTENTDM_HOME = "http://somedomain.somewhere.org"; // public-facing CONTENTdm domain |
NewerOlder