Skip to content

Instantly share code, notes, and snippets.

View camillevilla's full-sized avatar

Camille Villa camillevilla

View GitHub Profile
@camillevilla
camillevilla / reduce_fibonacci.rb
Created March 19, 2017 03:08
Fibonacci with Ruby's .reduce
# find the nth value of the Fibonacci sequence
def fibonacci(nth)
counter = 1
current_arr = [0, 1]
until counter == nth - 1
next_val = current_arr.reduce(0) {|sum, number| sum + number }
current_arr = [current_arr.last, next_val]
counter += 1
end
current_arr.last
@camillevilla
camillevilla / github-pr-urls.js
Last active September 17, 2018 17:47
Grab GitHub PR URLs for weekly dependency updates
// v2.1
// even bettah! Links with sort order retained + links to "Files changed"
// PR search at https://github.com/pulls
// is:pr org:sul-dlss head:update-dependencies created:2018-05-08..2018-05-09
// Repo order used in our update script and status table
// https://gist.github.com/cbeer/efefe04222dfb27bfbe5cad2076e2e83
var repoList= "purl stacks sul-embed purl-fetcher content_search course_reserves discovery-dispatcher earthworks exhibits library_hours_rails sul-bento-app sul-directory sul-requests sw-indexer SearchWorks revs dlme arclight-demo vatican_exhibits revs-indexer-service bassi_veratti editstore-updater mods_display_app mirador_sul frda relevancy_dashboard stanford-arclight searchworks-status"
repoList = repoList.split(' ')
@camillevilla
camillevilla / remove-gemnasium.sh
Created May 16, 2018 18:46
Remove gemnasium badges + make PRs
#!/bin/bash
cd $TMPDIR
mkdir -p $TMPDIR/.removegemnasium
cd $TMPDIR/.removegemnasium
for i in purl stacks sul-embed purl-fetcher content_search course_reserves discovery-dispatcher earthworks exhibits library_hours_rails sul-bento-app sul-directory sul-requests sw-indexer SearchWorks revs dlme arclight-demo vatican_exhibits revs-indexer-service bassi_veratti editstore-updater portfolios mods_display_app mirador_sul; do
echo $i
cd $TMPDIR/.removegemnasium
git clone [email protected]:sul-dlss/$i
cd $i
@camillevilla
camillevilla / humble-bundle-✨.js
Last active June 13, 2018 22:02
Bulk download humble bundle files
// Here ya go, dad! 2018-06-10
// Open Firefox
// Options / Preferences --> Tabs --> Open links in tabs instead of new windows
// Options / Preferences --> Applications --> PDF, Action: Save file
// Allow pop-ups from humblebundle.com
// With your Humble Bundle purchases tab open in Firefox:
// Firefox --> Web Tools --> Web Console
// Click the "Raw" button on this GitHub page and paste in the stuff below
@camillevilla
camillevilla / gem_report.rb
Last active June 26, 2018 14:44
Report: major / minor / patch versions updated by bundler in several repos
# Assumes a folder of .txt files with `bundle update` output
major = []
minor = []
patch = []
repos_updated = []
Dir.foreach('./gem_report') do |repo|
next if (repo == '.') || (repo == '..')
repo_name = repo.chomp('.txt')
puts "#{'*' * 20 } #{repo_name} #{'*' * 20 }"
@camillevilla
camillevilla / marcie.json
Created June 6, 2019 20:58
A sample IIIF Collection featuring 🐱
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://localhost:8080/mycollection/top",
"@type": "sc:Collection",
"label": "Marcie",
"description": "Pictures of Marceline the Vampire Queen",
"attribution": "Camille Villa",
"manifests": [
{
"@id": "http://free.iiifhosting.com/iiif/2ccd8d79021fea909a8195abcf7c2128250e5b62c56fd3ded8a36a3ef2252890/manifest.json",
@camillevilla
camillevilla / example.html
Created June 6, 2019 21:00
A Mirador 2 instance configured to show Collection tree browser
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="mirador/css/mirador-combined.css">
<title>Mirador Viewer</title>
<style type="text/css">
#viewer {
width: 100%;
@camillevilla
camillevilla / manifest.json
Created June 7, 2019 00:03
poetry sequence example
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://71b3deb8-e12b-452f-a961-def6179114fd",
"@type": "sc:Manifest",
"label": "[Click to edit label]",
"metadata": [],
"description": [
{
"@value": "[Click to edit description]",
"@language": "en"
@camillevilla
camillevilla / manifest.json
Last active October 22, 2019 18:59
Manifest for an item uploaded to test Spotlight instance w/ modified image service
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@type": "sc:Manifest",
"@id": "https://exhibits-stage.stanford.edu/external-iiif-and-upload-images-test-august-2019/catalog/107-6912/manifest",
"label": "morning glory uploaded - manifest from Camille's github gist",
"description": "This manifest has a modified image service URL.",
"sequences": [{
"@type": "sc:Sequence",
"@id": "https://exhibits-stage.stanford.edu/external-iiif-and-upload-images-test-august-2019/catalog/107-6912/manifest/sequence/normal",
"rendering": [],
@camillevilla
camillevilla / transifex.yml
Last active April 28, 2020 00:07
Transifex-GitHub integration config for Rails i18n YAML files
# example from projectblacklight/spotlight
filters:
- filter_type: file
file_format: YML
source_language: en
source_file: config/locales/en.yml
translation_files_expression: config/locales/<lang>.yml
- filter_type: file
file_format: YML
source_language: en