Skip to content

Instantly share code, notes, and snippets.

View ianthekirkland's full-sized avatar

Ian Kirkland ianthekirkland

View GitHub Profile
@johnksv
johnksv / bookmarkToFooterAdobeDC.js
Last active May 15, 2024 11:52
Adobe acrobat DC - Add footer with bookmark text
var aRect = [];
//Hard coded values for bottom left corner of A4 page
aRect[0] = 24.218078613281250;
aRect[1] = 45.985595703125;
aRect[2] = 485.0216979980469;
aRect[3] = 10.20367431640625;
//Page number that bookmark maps to
var a = [];
//Bookmark name, corresponding to array a
@JMichaelTX
JMichaelTX / Get & Set Functions for KM Variables JXA.js
Created February 11, 2016 01:34
JXA Functions to Get and Set Keyboard Maestro (KM) Variables using JavaScript for Automation (JXA)
//=====================================================================
function setKMVar(pstrName, pstrValue) {
//=====================================================================
var app = Application.currentApplication()
app.includeStandardAdditions = true
var appKM = Application("Keyboard Maestro Engine")
var oVars = appKM.variables
@JMichaelTX
JMichaelTX / JXA_PersistentProperties.js
Last active March 16, 2021 13:27 — forked from RobTrew/JXA_PersistentProperties.js
Persistent 'properties' for OS X JavaScript for Applications (JXA) Forked from Rob Trew
(function () {
'use strict';
// OSX JavaScript for Applications lacks the persistent 'properties'
// of AppleScript (in which global variables and properties persist between script runs)
// but we can, of course, serialise to JSON or plist at the end of a script
// parsing it at the start of the next run.
// Here is one approach to persistence between script runs
// using JSON.stringify() and JSON.parse()
@ttscoff
ttscoff / luckylink.sh
Created September 26, 2012 11:56
Google API Search from STDIN
@ttscoff
ttscoff / planter.rb
Created September 22, 2012 17:57
Create directory trees from indented text input
#!/usr/bin/ruby
=begin
Planter v1.3
Brett Terpstra 2013
ruby script to create a directory structure from indented data.
Three ways to use it:
- Pipe indented (tabs or 2 spaces) text to the script
- e.g. `cat "mytemplate" | planter.rb
- Create template.tpl files in ~/.planter and call them by their base name
@ttscoff
ttscoff / speedmail.applescript
Last active December 8, 2023 22:00
Speed up Mail.app
(*
Speed up Mail.app by vacuuming the Envelope Index
Code from: http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/
Originally by "pmbuko" with modifications by Romulo
Updated by Brett Terpstra 2012
Updated by Mathias Törnblom 2015 to support V3 in El Capitan and still keep backwards compability
Updated by @lbutlr for V5 and Container folder in High Sierra and use du
*)
tell application "Mail" to quit
@casualjim
casualjim / jquery.tweetArea.coffee
Created August 11, 2012 23:34
CoffeeScript version of jQuery text area with offset calculation for pasted urls
$ = jQuery
$.fn.extend
tweetArea: (options) ->
settings =
offset: 21
charDisplay: '#char-count'
warnAt: 120
postBox: '#tweet-area'
max: 140
@ttscoff
ttscoff / wp_mangler.rb
Created July 26, 2012 11:57
wp_mangler: runs a replace on WordPress post content
#!/usr/bin/env ruby
# Requires 'sequel' and 'mysql' rubygems
require 'rubygems'
require 'sequel'
require 'cgi'
def e_sql(str)
str.to_s.gsub(/(?=[\\])/, "\\")
end