Skip to content

Instantly share code, notes, and snippets.

View ROT13_iOS_shortcut.js
function getMeta(metaName) {
const metas = document.getElementsByTagName('meta');
for (let i = 0; i < metas.length; i++) {
if (metas[i].getAttribute('property') === metaName) {
return metas[i].getAttribute('content');
}
}
return '';
View get_url_from_safari_tabs.js
Safari = Application('Safari');
Safari.includeStandardAdditions = true;
SystemEvents = Application('System Events')
SystemEvents.includeStandardAdditions = true;
activeAppName = SystemEvents.processes.whose({frontmost:true}).at(0).name();
activeApp = Application(activeAppName);
function run(){
frontWindow = Safari.windows.at(0);
SystemEvents.activate()
View alfred_clipboard_to_csv.sh
sqlite3 -header -csv "$HOME/Library/Application Support/Alfred 3/Databases/clipboard.alfdb" "select item, app from clipboard;" > ~/Desktop/out.csv
View todos_sublime.sh
function ga_code_search() {
# alias todo='ga_code_search "TODO\(`whoami`\)"'
SCREEN_WIDTH=`stty size | awk '{print $2}'`
SCREEN_WIDTH=$((SCREEN_WIDTH-4))
# Given a spooky name so you can alias to whatever you want.
# (cs for codesearch)
# AG is WAY faster but requires a binary
# (try brew install the_silver_searcher)
View todos_emacs.sh
function ga_code_search() {
# alias todo='ga_code_search "TODO\(`whoami`\)"'
SCREEN_WIDTH=`stty size | awk '{print $2}'`
SCREEN_WIDTH=$((SCREEN_WIDTH-4))
# Given a spooky name so you can alias to whatever you want.
# (cs for codesearch)
# AG is WAY faster but requires a binary
# (try brew install the_silver_searcher)
View addressbook_objc.js
/*
References:
http://www.macdevcenter.com/pub/a/mac/2002/08/27/cocoa.html?page=2
https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AddressBook/Tasks/AccessingData.html#//apple_ref/doc/uid/20001023-BABHHIHC
*/
View flickrDownloader.py
"""
You can download the flickr API by running
pip install flickrapi
Info here:
http://stuvel.eu/media/flickrapi-docs/documentation/2-calling.html
You'll need to create a Flickr API app here:
View pushover.py
import httplib
import urllib
def pushover(title, message):
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request(
"POST", "/1/messages.json",
urllib.urlencode({
"token": "",
View rent_receipt.applescript
app = Application("PdfPenPro")
app.includeStandardAdditions = true;
templatePath = Path("/Users/username/Rent Receipt Template.pdf")
savePath = Path("/Users/rjames/apartment")
var getByName = function(fileName){
return app.documents.byName(fileName);
}
View vnc_favorites.py
from xml.etree.ElementTree import Element, SubElement, tostring
from os import path
from Foundation import (
CFPreferencesAppSynchronize,
CFPreferencesCopyAppValue,
CFPreferencesCopyKeyList,
CFPreferencesSetValue,
kCFPreferencesAnyUser,
kCFPreferencesCurrentHost
You can’t perform that action at this time.