Skip to content

Instantly share code, notes, and snippets.

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 '';
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()
sqlite3 -header -csv "$HOME/Library/Application Support/Alfred 3/Databases/clipboard.alfdb" "select item, app from clipboard;" > ~/Desktop/out.csv
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)
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)
/*
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
*/
"""
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:
import httplib
import urllib
def pushover(title, message):
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request(
"POST", "/1/messages.json",
urllib.urlencode({
"token": "",
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);
}
from xml.etree.ElementTree import Element, SubElement, tostring
from os import path
from Foundation import (
CFPreferencesAppSynchronize,
CFPreferencesCopyAppValue,
CFPreferencesCopyKeyList,
CFPreferencesSetValue,
kCFPreferencesAnyUser,
kCFPreferencesCurrentHost