Skip to content

Instantly share code, notes, and snippets.

View sheepeeh's full-sized avatar

Rachel Donahue sheepeeh

View GitHub Profile
@sheepeeh
sheepeeh / copyFromPrevColumn.vbs
Last active March 30, 2020 15:35
Word VBA: Copy text from previous column if current column is empty
' Usage: Select/place your cursor in the cell you want to copy text TO,
' then run the macro. It will loop through all rows, so only select
' one cell.
' The first macro will copy text into blank cells for the currently
' selected table.
'
' The second will do this for the selected columns in all tables
' in the document.
'
@sheepeeh
sheepeeh / move_issues.rb
Created January 4, 2017 21:37
"copy" issues from one github repo to another
require 'octokit'
require_relative 'gapi_config'
############################################################################
# Copy issues and comments from one repository to another (sort of). #
# Because there is no way to copy issues directly, this script will #
# create new issues with the original metadata in the issue's body. #
# #
# NOTE: Assignees and issue status are included in the metadata block, #
# but the new issue itself will be open and unassigned. #
@sheepeeh
sheepeeh / Stack Exchange.js
Created June 6, 2016 15:52
For adding SE questions to Zotero. (No Multi-scraper.)
{
"translatorID": "508a49ba-18cb-4ead-b928-2a7b230450aa",
"label": "Stack Exchange",
"creator": "Rachel Donahue",
"target": "(http)(s)?:\\/\\/(\\w*\\.)?(stack)(overflow|exchange)(\\.com)(\\/questions)(.*)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
@sheepeeh
sheepeeh / NALDC.js
Last active June 3, 2016 18:27
Zotero translator for http://naldc.nal.usda.gov/naldc/home.xhtml (single items only)
// Currently only creates slightly wonky Report items, as there is no way to identify itemType from the page content.
{
"translatorID": "3f682e1e-a845-41f3-a5e9-4aad993e5090",
"label": "NALDC",
"creator": "Rachel Donahue",
"target": "http://naldc.nal.usda.gov/[\\w-_]*",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
@sheepeeh
sheepeeh / prepWordForHtml.vb
Last active June 22, 2020 13:51
Get clean HTML from a template-generated Word document (also requires pandoc)
' The final step in the process requires pandoc http://pandoc.org/
' This was designed for our particular Finding Aid template, so some sections might not apply. The ConvertHeadings function, in particular, references a custom style and decrements all Heading sizes by 1.
' Running the prepWordForHtml macro will do the following:
' - Remove all Content Controls (but preserve the content)
' - Convert list numbering to plain text
' - Change Box Heading Style to Heading 3
' - Change Heading 2 to Heading 3
' - Change Heading 1 to Heading 2
' - Delete Captions
' - Delete TOC Heading text
@sheepeeh
sheepeeh / fancybox-keyboard-focus.js
Last active November 18, 2016 22:34
Make fancybox more friendly to keyboard users. Title information is specific to Omeka, but the rest should work anywhere.
// Omeka loads jQuery No Conflict by default, so we can't use $
jQuery(document).ready(function() {
/* Code to make fancybox more accessible
Be sure to also set .fancybox-nav span's visibility to "visible"
so buttons are shown without the mouse. */
jQuery('.fancybox').fancybox({
openEffect : 'none',
closeEffect : 'none',
@sheepeeh
sheepeeh / wpd2docx.vb
Last active July 21, 2016 19:11
Convert WPD to DOCX using a Word macro
Function browseForFolder()
Dim intResult As Integer
Dim strPath As String
'the dialog is displayed to the user
intResult = Application.FileDialog(msoFileDialogFolderPicker).Show
'checks if user has cancled the dialog
If intResult <> 0 Then
'dispaly message box
browseForFolder = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1)
End If
@sheepeeh
sheepeeh / fix_sitemap_for_omeka.rb
Last active August 29, 2015 14:11
Add real last modified dates, priorities, and change frequencies to XML Sitemaps-generated sitemaps for Omeka.
#--------------------------------------------------------------------------------------------------------------
# This is the script I use to add real dates, change frequencies, and priorities to Omeka items,
# exhibits, and simple pages to sitemaps generated with the XML Sitemap tool.
# https://www.xml-sitemaps.com/standalone-google-sitemap-generator.html
#
# I use the following settins in order to keep the number of URLs down (only include simple pages, exhibits
# and exhibit pages, exhibit items, and collection pages).
#
# Exclude from sitemap extensions:
# divx flv zip m4a m4v rar tar bz2 tgz exe gif tif jpg png class jar mpeg mpg mp3 wav mp4 avi wmv
@sheepeeh
sheepeeh / filerename.rb
Last active August 29, 2015 14:02
Rename files in the current directory based on a tab-delimited file.
# REQUIRES os_dir, available at https://gist.github.com/sheepeeh/39c25bd67ccc09ad78a0
# place in an easy to remember directory or add to your PATH. Expects (C/T)SV headings "oldname" and "newname."
# USAGE: filename.rb file_with_filenames.csv
require 'csv'
require_relative 'os_dir'
def rename_files(source)
current_dir
@sheepeeh
sheepeeh / os_dir.rb
Created June 20, 2014 14:58
Get the current working directory (used for many of my little command line utilities.)
require 'rbconfig'
def init
@os
@current_dir
end
def os
@os ||= (
host_os = RbConfig::CONFIG['host_os']