Skip to content

Instantly share code, notes, and snippets.

@kopischke
kopischke / backlinks.js
Created February 16, 2021 15:21 — forked from theomichel/backlinks.js
This script attempts to automatically create back-links for an Airtable linked record that references the same table.
@kopischke
kopischke / Functions.js
Last active August 15, 2020 12:58
Code snippets for Script actions in Airtable Automations
// Utility functions for Airtable Automations
/**
* @param {string} url
* @param {Base} [forBase=base]
*/
function getTableFromURL(url, forBase) {
let root = forBase ? forBase : base
let found = url.match(/^https?:\/\/airtable.com\/(?<tableID>[^\/]+)/)
return root.getTable(found.groups.tableID)

Keybase proof

I hereby claim:

  • I am kopischke on github.
  • I am kopischke (https://keybase.io/kopischke) on keybase.
  • I have a public key ASDlnW91QWJYnnfX16uSbgTz8vs6bl9Hac88FlzzZbbwjAo

To claim this, I am signing this object:

@kopischke
kopischke / alias_completion.sh
Last active June 4, 2022 00:53
Automatically add completion functions for aliases
# Automatically add completion for all aliases to commands having completion functions
function alias_completion {
local namespace="alias_completion"
# parse function based completion definitions, where capture group 2 => function and 3 => trigger
local compl_regex='complete( +[^ ]+)* -F ([^ ]+) ("[^"]+"|[^ ]+)'
# parse alias definitions, where capture group 1 => trigger, 2 => command, 3 => command arguments
local alias_regex="alias ([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'"
# create array of function completion triggers, keeping multi-word triggers together
@kopischke
kopischke / markdown2evernote.rb
Created June 5, 2011 16:57
OS X service scripts
#!/usr/bin/env ruby -wKU
# Adapted from Brett Terpstra’s original “Markdown to Evernote” service (http://brettterpstra.com/a-better-os-x-system-service-for-evernote-notes-with-multimarkdown/)
# Martin Kopischke 2011 – License: Creative Commons Attribution Share-Alike (CC BY-SA) 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/)
# Changes: – create only one Evernote note per (Multi)Markdown input passed (instead of one per line)
# – do not choke on shell escape characters (use Tempfile instead of shell pipe for osascript)
# – default to MultiMarkdown 3 executable (instead of MMD 2 Perl script)
# – make smart typography processing optional (set SMARTY to 'false' to bypass processing;
# note smart typography cannot be disabled in MMD 3.0 and 3.0.1
# – handle both smart typography processing scripts (ie. SmartyPants.pl)