Skip to content

Instantly share code, notes, and snippets.

@LK64076007A
LK64076007A / MD2HTML
Created May 29, 2016 21:04
Javascript for converting Markdown to HTML without line breaks using TextExpander
%snippet:marked.min.js% // import marked.min.js library
marked(TextExpander.pasteboardText).replace(/(\n)+/g, '');
@LK64076007A
LK64076007A / gist:077d5b4b503a6d7891de
Created October 17, 2015 19:41
Regex mute filter for all baseball team names in Tweetbot
tweetbot:///mute/keyword?regex=1&text=Angels%7CAstros%7CAthletics%7CBlue%20Jays%7CBraves%7CBrewers%7CCardinals%7CCubs%7CDiamondbacks%7CDodgers%7CGiants%7CIndians%7CMariners%7CMarlins%7CMets%7CNationals%7COrioles%7CPadres%7CPhillies%7CPirates%7CRangers%7CRays%7CRed%20Sox%7CReds%7CRockies%7CRoyals%7CTigers%7CTwins%7CWhite%20Sox%7CYankees
@LK64076007A
LK64076007A / Prepend YYYY-MM-DD formatted date to each line
Last active August 29, 2015 14:07
This is some JavaScript that prepends the date to each line of some text in Drafts 4 for iOS.
var date = new Date().toISOString().replace(/(\d+-\d+-\d+).+/gm,'$1 ');
draft.content = draft.content.replace(/^/gm,date);
@LK64076007A
LK64076007A / iTunes Affiliate Link.py
Created November 27, 2013 02:06
iTunes Affiliate Link
@LK64076007A
LK64076007A / Side by side image combine.py
Created October 26, 2013 00:51
Side by side image combine
import photos
import Image
import console
im1 = photos.pick_image(show_albums=False)
im2 = photos.pick_image(show_albums=False)
width1, height1 = im1.size
width2, height2 = im2.size
@LK64076007A
LK64076007A / Merge and Upload.py
Created March 6, 2013 02:38
Merge and Upload
import photos
from dropboxlogin import get_client
dropbox_client = get_client()
import keychain
import console
import time
import httplib
from io import BytesIO
import datetime
import webbrowser
@LK64076007A
LK64076007A / Create image of side by side screeshots.py
Created March 5, 2013 14:46
Create image of side by side screeshots
"""
This code takes two screenshots from the camera roll combines them into one image and saves the new image to the camera roll.
This is adapted from Federico Viticci's blog post at:
http://www.macstories.net/stories/automating-ios-how-pythonista-changed-my-workflow/
It removes the option to change which picture is where, automatically assigning the first one chosen as the leftmost image.
It also removes the necessity to copy the images to the clipboard outside of Pythonista using the new photos library in version 1.3. Finally, it removes the clipboard output.
"""
import photos
@LK64076007A
LK64076007A / Regex replace.py
Last active December 10, 2015 09:29
Added multiline regex flag.
import clipboard, console, re
mytext = clipboard.get()
# User input text
matchedText = console.input_alert("Find", "Enter text/regex to find.")
replacedText = console.input_alert("Replace", "Enter text to replace.")
# Regex find and replace
mytext = re.sub(matchedText, replacedText, mytext, flags=re.MULTILINE)