Skip to content

Instantly share code, notes, and snippets.

@ttscoff
ttscoff / bid.sh
Created July 31, 2012 20:27
Retrieve Bundle Identifiers for OS X applications using semi-fuzzy string matching
bid() {
local shortname location
# combine all args as regex
# (and remove ".app" from the end if it exists due to autocomplete)
shortname=$(echo "${@%%.app}"|sed 's/ /.*/g')
# if the file is a full match in apps folder, roll with it
if [ -d "/Applications/$shortname.app" ]; then
location="/Applications/$shortname.app"
else # otherwise, start searching
@benwaldie
benwaldie / 2013-04-21-TUAW_Waldie.applescript
Created April 22, 2013 02:02
TUAW > Extract App Resource Icons with AppleScript
-- Ask the user to select an app
set theApp to choose file of type "app" default location (path to applications folder)
-- Get the app name
tell application "System Events"
set theAppName to name of theApp
if theAppName ends with ".app" then set theAppName to text 1 thru -5 of theAppName
-- Determine whether the app is a package, and notify the user if it's not
set isPackage to (package folder of theApp)
@PizzaBrandon
PizzaBrandon / jquery.waituntilexists.js
Last active August 24, 2023 14:23 — forked from buu700/jquery.waituntilexists.js
Updated waitUntilExists plugin
;(function ($, window) {
var intervals = {};
var removeListener = function(selector) {
if (intervals[selector]) {
window.clearInterval(intervals[selector]);
intervals[selector] = null;
}
@carlosefonseca
carlosefonseca / Add lines as Reminders
Last active January 3, 2016 21:59
Add selected lines of text as new reminders. Asks for what list. Use as Automator service script. Requires http://applescript.bratis-lover.net/library/string/ to be a Script Library.
on run {input, parameters}
set input to (first item of input)
tell script "_string" to set input to trimBoth(input)
set lst to every paragraph of input
tell application "Reminders"
activate
set aList to (name of lists)
set theList to some list whose name is (first item of (choose from list aList))
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@jtwalters
jtwalters / quit-and-relaunch.applescript
Created March 4, 2014 22:21
Quit and relaunch an application in AppleScript, e.g., Google Chrome—to finish installing updates.
set appName to "Google Chrome"
tell application appName to quit
repeat
tell application "System Events"
if appName is not in (name of application processes) then exit repeat
end tell
do shell script "sleep 0.5"
end repeat
tell application appName to launch
@salcode
salcode / .gitignore
Last active July 15, 2024 17:12
.gitignore file for a general web project - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore
# Bare Minimum Git
# https://salferrarello.com/starter-gitignore-file/
# ver 20221125
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore
# to download this file
#
@n8henrie
n8henrie / txt_to_reminders.applescript
Last active March 11, 2024 17:04
Demonstration of using AppleScript with Reminders.app
--taken from http://benguild.com/2012/04/11/how-to-import-tasks-to-do-items-into-ios-reminders/#comment-1346894559
--set theFileContents to (read file "Users:n8henrie:Desktop:Reminders.txt") -- Change this to the path to your downloaded text file with your tasks in it! (Note the : instead of a / between folders) Or, just name them Reminders.txt and put them in your downloads folder
--set theLines to paragraphs of theFileContents
set theLines to {"task name 1", "task name 2"}
repeat with eachLine in theLines
tell application "Reminders"
set mylist to list "Your List Name"
tell mylist
make new reminder at end with properties {name:eachLine, due date:date "7/10/2014 3:00 PM"}
@jonobr1
jonobr1 / auto-capture.scpt
Last active March 21, 2024 02:34
A small AppleScript to take a screenshot every 30 seconds for 8 hours. Saves to an Image Sequence in a desktop folder. Great for recording your workday.
set dFolder to "~/Desktop/screencapture/"
do shell script ("mkdir -p " & dFolder)
set i to 0
repeat 960 times
do shell script ("screencapture " & dFolder & "frame-" & i & ".png")
delay 30 -- Wait for 30 seconds.
set i to i + 1
end repeat
set dFolder to "~/Desktop/screencapture/"
do shell script ("mkdir -p " & dFolder)
set i to 0
repeat 960 times
set tTime to do shell script "date +%H%M%S"
do shell script ("screencapture " & dFolder & "frame-" & i & ".png")
delay 30 -- Wait for 30 seconds.
set i to i + 1