Skip to content

Instantly share code, notes, and snippets.

View JMichaelTX's full-sized avatar

JMichaelTX JMichaelTX

View GitHub Profile
@santisbon
santisbon / Search my gists.md
Last active April 22, 2024 14:15
How to #search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@umireon
umireon / jxa-timeout.js
Created November 30, 2016 17:52
setTimeout, setInterval, clearTimeout, and clearInterval on JXA (JavaScript for Automation) on macOS
if (typeof exports === 'undefined') exports = {}
function timer (repeats, func, delay) {
var args = Array.prototype.slice.call(arguments, 2, -1)
args.unshift(this)
var boundFunc = func.bind.apply(func, args)
var operation = $.NSBlockOperation.blockOperationWithBlock(boundFunc)
var timer = $.NSTimer.timerWithTimeIntervalTargetSelectorUserInfoRepeats(
delay / 1000, operation, 'main', null, repeats
)
@JMichaelTX
JMichaelTX / Main.css
Last active August 29, 2017 08:25 — forked from chrisphenry/Main.css
Safari 7 & 9 - Customise Web Inspector font
/*Customise Safari Web Inspector font*/
/*(tested on Safari 7.0.1 on OS X Mavericks)*/
/* Tested on Safari 9.1 (11601.5.17.1) on OSX 10.11.4 as of 2016-05-08 */
/*
JMichaelTX NOTE:
- This process was written for Safari 7 (Mavericks)
- I found it worked fine with Safari 9.1 (11601.5.17.1) on OSX 10.11.4, with just a few simple changes (noted below)
*/
@ccstone
ccstone / Create date-string using ICU Date-Time Format Syntax.applescript
Last active June 5, 2021 20:47
Use AppleScriptObjC (ASObjC) to Create a date-string using ICU Date-Time Format Syntax
-------------------------------------------------------------------------------------------
# Auth: Shane Stanley & Christopher Stone
# dCre: 2014/01/19 09:46 +1100
# dMod: 2016/02/24 15:18 -0600
# Appl: AppleScriptObjC
# Task: Create a date-string using ICU Date-Time Format Syntax
# : http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @AppleScriptObjC, @ASObjC, @Shane, @Date, @String
@RobTrew
RobTrew / JXA_PersistentProperties.js
Last active January 30, 2024 09:07
Persistent 'properties' for OS X JavaScript for Applications (JXA)
(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()
@ccstone
ccstone / References For Learning & Using Applescript.md
Last active February 21, 2024 05:34
References For Learning & Using Applescript

REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47


NOTES

AppleScript is a rather peculiar scripting language to learn.

@RobTrew
RobTrew / safariXPathGoogleResultLinks.js
Created May 30, 2015 02:24
Harvest Google result links from Safari with XPATH (as MD) with //*[@Class='r']/a
@RobTrew
RobTrew / jxaClickAppSubMenuItem.applescript
Last active January 16, 2023 20:15
Yosemite JXA Javascript Function for clicking application sub-menu items
// Click an OS X app sub-menu item
// 2nd argument is an array of arbitrary length (exact menu item labels, giving full path)
// e.g. menuItemClick("InqScribe", ['View', 'Aspect Ratio', 'Use Media Ratio'])
// Note that the menu path (spelling & sequence) must be exactly as in the app
// See menuItemTestClick() below for a slower version which reports any errors
// For macOS Yosemite to Sierra
@RobTrew
RobTrew / JXA_UIToggle.applescript
Created February 24, 2015 13:06
OS X Yosemite Javascript for Applications (JXA): Toggling background, dark mode, and screen color inversion between day ⇄ night settings
function run() {
// Rob Trew 2015
// Ver 0.01
// UI day/night toggling through OS X 10.10 JXA Javascript for Automation
// SWITCH FROM DAY-TIME DARK MENU BAR AND DOCK WITH DARK BACKGROUND
// TO NIGHT-TIME *ALL DARK*
// (TOGGLE MODE AND BACKGROUND TO BRIGHT, THEN INVERT ALL)