Skip to content

Instantly share code, notes, and snippets.

View cdmo's full-sized avatar

Charlie Morris cdmo

  • the middle of pennsylvania
  • X @cdmo
View GitHub Profile
@cdmo
cdmo / formatTime.js
Last active December 21, 2015 08:49
formatting time
// Shape the timestamp just so
function formatTime(timestamp){
var time = new Date(timestamp * 1000);
var hours = time.getHours()-(time.getTimezoneOffset()/60); // assuming behind the meridian
var minutes = time.getMinutes();
minutes = minutes < 10 ? '0' + minutes : minutes;
hours = hours > 12 ? hours - 12 : hours;
if (hours === 0){
return '12:' + minutes + 'A.M.';
} else if (hours < 12) {
@cdmo
cdmo / mdtalk.html
Last active December 23, 2015 13:39 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<style type='text/css'>
li {
margin-left: 60px;
}
# stolen from http://sourceforge.net/p/cosign/mailman/cosign-discuss/thread/4E302E4A.7050602@psulias.psu.edu/
# get your cookies
curl -L -b /tmp/cookies.txt -c /tmp/cookies.txt https://yourcosignlogin.com
# attempt to login
curl -L -b /tmp/cookies.txt -c /tmp/cookies.txt https://yourcosignlogin.com/cosign.cgi \
--data "login=username&password=password"
# now access your protected site
curl -L -b /tmp/cookies.txt -c /tmp/cookies.txt https://someothersite.com/pathtoresource
function diff_mods { colordiff <(drush "$1" pml --status=enabled --pipe) <(drush "$2" pml --status=enabled --pipe); };
export -f diff_mods
@cdmo
cdmo / .vimrc
Created December 13, 2017 13:13
set backspace=2 " backspace in insert mode works like normal editor
set shiftwidth=2 " indent by 2 spaces when auto-indenting
set softtabstop=2 " indent by 2 spaces when hitting tab
syntax on " syntax highlighting
filetype indent on " activates indenting for files
set autoindent " auto indenting
set number " line numbers
colorscheme desert " colorscheme desert
set nobackup " get rid of anoying ~file
@cdmo
cdmo / eventracking.js
Created June 28, 2018 02:53
Event tracking for google analytics on the penn state bento search results page
function EventTrackingBento(element, category) {
var tags = {};
var category = category;
this.boxes = function() {
return document.querySelectorAll(element);
};
this.tagEvents = function() {
if (this.boxes) {
@cdmo
cdmo / test_blacklight.py
Created April 4, 2019 12:20
Naive locust script to test home page loads, facet selections using our top genres and searches using animals and countries
from locust import HttpLocust, TaskSet
def index(l):
l.client.get("/")
def facet_genre(l):
import random
facet_genre_terms = ['Electronic books','Congresses','Periodicals','Early works to 1800','Biography','Maps','Streaming audio','Legislative hearings','Fiction','Legislative materials','Statistics','Handbooks, manuals, etc','Bibliography','Juvenile fiction','Scores','Case studies','Exhibitions','Electronic journals','Juvenile literature','History']
path = "/?f[genre_facet_ssim][]=%s&search_field=all_fields" % (random.choice(facet_genre_terms))
@cdmo
cdmo / debug_query.json
Last active April 9, 2019 16:22
parsedquery_toString debug output of search on "geographic information systems"
"parsedquery_toString":"+(((
(series_title_tsim:geographic)^10.0 |
(title_245ab_tsim:geographic)^25000.0 |
notes_summary_ssim:geographic |
(author_unstem_search:geographic)^250.0 |
(subject_addl_tsim:geographic)^50.0 |
toc_ssim:geographic |
(subject_unstem_search:geographic)^750.0 |
all_text_timv:geographic |
(subject_addl_unstem_search:geographic)^250.0 |
DEPRECATION WARNING: The @document instance variable is deprecated and will be removed in Blacklight-marc 8.0 (called from render_refworks_action? at /Users/cdm32/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/blacklight-marc-c0ff1d9cb5d3/lib/blacklight/marc/catalog.rb:25)
DEPRECATION WARNING: The @document instance variable is deprecated and will be removed in Blacklight-marc 8.0 (called from render_refworks_action? at /Users/cdm32/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/blacklight-marc-c0ff1d9cb5d3/lib/blacklight/marc/catalog.rb:25)
DEPRECATION WARNING: The @document instance variable is deprecated and will be removed in Blacklight-marc 8.0 (called from render_endnote_action? at /Users/cdm32/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/blacklight-marc-c0ff1d9cb5d3/lib/blacklight/marc/catalog.rb:29)
DEPRECATION WARNING: The @document instance variable is deprecated and will be removed in Blacklight-marc 8.0 (called from render_endnote_action? at /Users/cdm32/.rbenv/versions/2
---
# - name: Blacklight Solr | List zookeeper configsets
# uri: "{{ solr_install_path }}"/solr/admin/configs?action=LIST&omitHeader=true
# register: existing_configsets_list
- name: Blacklight Solr | Zip the current zookeeper configsets
archive:
path:
- "{{ rails_app_install_path }}/solr/conf/*"