Skip to content

Instantly share code, notes, and snippets.

View derickfay's full-sized avatar

Derick Fay derickfay

View GitHub Profile
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# codercase.py
#
# 2014-08-28 by Derick Fay
#
# based almost entirely on jdc0589's CaseConversion plug-in for SublimeText:
# https://github.com/jdc0589/CaseConversion/blob/master/case_conversion.py
#
tell application "DEVONthink 3"
set theBases to databases
set theList to {}
set myitems12345 to {}
repeat with b in theBases
tell b
set theRecs to (every record whose type is group) & (every record whose type is smart group)
repeat with r in theRecs
set title to {title:name of r}
@derickfay
derickfay / exportMarkdown.md
Created July 12, 2019 05:36
BibDesk Markdown export template

<$publications> <$pubType=book?> <$pubAuthors.abbreviatedNormalizedName.stringByRemovingTeX.@componentsJoinedByCommaAndAnd/> <$pubFields.Year/>. <$pubFields.Title/>. <$pubFields.Address/>: <$pubFields.Publisher/>.

<$pubAuthors.abbreviatedNormalizedName.stringByRemovingTeX.@componentsJoinedByCommaAndAnd/> <$pubFields.Year/>. <$pubFields.Title/>. In <$pubFields.Booktitle/>. <$pubEditors.abbreviatedNormalizedName.stringByRemovingTeX.@componentsJoinedByCommaAndAnd/>, eds. <$pubFields.Pages?>Pp. <$pubFields.Pages/></$pubFields.Pages?>. <$pubFields.Address/>: <$pubFields.Publisher/>.

$pubType=article?>

@derickfay
derickfay / sk2c single note templated.applescript
Created March 9, 2019 23:49
Export selected Skim notes to the clipboard using native Skim templates
(* EXPORT SELECTED NOTES TO THE CLIPBOARD
(no longer) requires hackademic URL handler from github user smargh
entirely rewritten to take advantage of Skim's built-in templating
2019-03-10 by derickfay
*)
property LF : (ASCII character 10)
@derickfay
derickfay / Dates.js
Last active March 2, 2019 04:50
Date text formatter for Copied
// there are two parts to this text formatter. Both draw heavily from
// the date calculation snippets created by Brett Terpstra - see
// https://brettterpstra.com/2015/06/01/textexpander-5-javascript-snippets/
// part 1 - the date library
// strftime for JS <http://hacks.bluesmoon.info/strftime/>
Date.prototype.locale = 'en-GB';
Date.ext = {};
Date.ext.util = {};
@derickfay
derickfay / export skim notes to markdown on clipboard sorting by color.applescript
Last active June 21, 2019 17:19
export skim notes to markdown on clipboard sorting by color.applescript
(* EXPORT ALL SKIM NOTES TO THE CLIPBOARD
(no longer) requires hackademic URL handler from github user smargh
entirely rewritten to take advantage of Skim's built-in templating
2016-06-26 by derickfay
2019-02-09 updated to group notes by color
*)
property LF : (ASCII character 10)
@derickfay
derickfay / btt-skim.json
Last active October 1, 2020 19:49
Skim Touch Bar preset
[
{
"BTTTouchBarButtonName" : "P",
"BTTTriggerType" : 629,
"BTTTriggerClass" : "BTTTriggerTypeTouchBar",
"BTTPredefinedActionType" : 172,
"BTTPredefinedActionName" : "Run Apple Script (blocking)",
"BTTInlineAppleScript" : "tell application \"BetterTouchTool\"\r\t(* light purple *)\r\tupdate_trigger \"625CCE43-9BF7-403E-8AEF-331CA96BBD0E\" json \"{\\\"BTTTriggerConfig\\\":{\\\"BTTTouchBarButtonColor\\\" : \\\"204,102,255,100\\\"}}\"\r\t(* dim yellow *)\r\tupdate_trigger \"701399EC-B8BF-472D-8A2E-4F9FB5F01F75\" json \"{\\\"BTTTriggerConfig\\\":{\\\"BTTTouchBarButtonColor\\\" : \\\"0,0,0,20\\\"}}\"\r\t(* dim green *)\r\tupdate_trigger \"E395E5B6-E655-47EA-BDD1-F6BE0086BE3B\" json \"{\\\"BTTTriggerConfig\\\":{\\\"BTTTouchBarButtonColor\\\" : \\\"0,0,0,20\\\"}}\"\r\t(* dim text selection *)\r\tupdate_trigger \"E5BDF354-1D20-414A-A7B8-A2861F299A3B\" json \"{\\\"BTTTriggerConfig\\\":{\\\"BTTTouchBarButtonColor\\\" : \\\"0,0,0,20\\\"}}\"\r\t(* dim underline *)\r\tupdate_trigger \"EC62F039-63
@derickfay
derickfay / bttGlobal.json
Created July 17, 2018 10:23
Global toggle button for BTT
{
"BTTTouchBarButtonName" : "Global",
"BTTTriggerType" : 629,
"BTTTriggerClass" : "BTTTriggerTypeTouchBar",
"BTTPredefinedActionType" : 190,
"BTTPredefinedActionName" : "Force Show\/Hide Global BTT Touch Bar Actions",
"BTTEnabled2" : 1,
"BTTUUID" : "937923F9-24F3-4AD7-883F-7DE9E2D3FA30",
"BTTEnabled" : 1,
"BTTOrder" : 5,
@derickfay
derickfay / clean.js
Created May 11, 2018 16:58
Clean scraped results from the National Archives of South Africa
// scraper for http://www.national.archsrch.gov.za/sm300cv/smws/sm300dl
//
// usage: select results in search results, enter multiple documents view, then copy contents of the results frame to a text file called archives.txt
const fieldnames = ["Document","DEPOT","SOURCE","TYPE","VOLUME_NO","SYSTEM","REFERENCE","PART","DESCRIPTION","STARTING","ENDING","REMARKS.*"]
const replacements = ["",",",",",",",",",",",",",",",",",",",",",""]
var fs = require('fs');
var path = process.cwd();
let d = fs.readFileSync(path + "/archives.txt").toString().replace(/\,/g," ");
@derickfay
derickfay / Broke.js
Created April 23, 2018 21:18
Broken prompt
// See online documentation for examples
// http://getdrafts.com/scripting
var p = Prompt.create();
p.title = "";
p.message = "";
p.addButton("Add to draft");
p.addTextField("Enter text", "t","");
var con = p.show();