Skip to content

Instantly share code, notes, and snippets.

View mattcassinelli's full-sized avatar

Matthew Cassinelli mattcassinelli

View GitHub Profile
import UIKit
import PlaygroundSupport
let vc = UIViewController()
vc.view.backgroundColor = .white
PlaygroundPage.current.liveView = vc
PlaygroundPage.current.needsIndefiniteExecution = true
let button = UIButton(type: .system)
button.frame = CGRect(x: 0, y: 0, width: 240, height: 120)
@mattcassinelli
mattcassinelli / Drafts_Template_Web-Capture
Created October 27, 2014 00:36
Change Drafts 4 Web Capture Template to Markdown quote & reference
[[[title]]][1]:
> [[selection]]
[1]: [[url]]
@mattcassinelli
mattcassinelli / Drafts_Javacsript_Redo-List-Order
Created October 27, 2014 00:35
Re-number a list in Drafts 4
function renumber(s) {
var rgx=/^\d+\. /m,
list=s.split(rgx),
count;
list.shift();
count = list.length;
for(var i=0; i<count; i++) {
list[i] = (i+1).toString() + '. ' + list[i];
}
return list.join('');
@mattcassinelli
mattcassinelli / Drafts_Javascript_Timestamp
Created October 27, 2014 00:30
Insert timestamp into Drafts
function getDateTime() {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth()+1;
var day = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
if(month.toString().length == 1) {
var month = '0'+month;
@mattcassinelli
mattcassinelli / Drafts_Javascript_Sort-Lines
Created October 27, 2014 00:28
Sort lines in Drafts 4
function generate(s){
var temp = new Array();
temp = s.split('\n');
temp.sort();
var result = "";
var i;
for(i=0; i<temp.length; i++) {
result += temp[i] + "\n";
}
return result;
@mattcassinelli
mattcassinelli / Twitter_Mac_CircularAvatars
Last active August 29, 2015 14:08
Get circular avatars on Twitter for Mac
defaults write com.twitter.twitter-mac CircularAvatars -bool true
# Pythonista script to create a Launch Center Pro action with all my
# updated grocery lists.
# Author: Aaron Bach
# www: http://www.bachyaproductions.com/
import json
import os
import sys
import urllib
import urllib2
javascript:window.location='launchpro://?url='+encodeURIComponent('launchpro://?url=[list:URL: ' +location.href+'|🔵 Tweetbot=tweetbot://viticci/post?text={{'+location.href+'}}|📌 Pinswift=pinswift://x-callback-url/add?url={{'+location.href+'}}|✅ To Check Out=drafts://x-callback-url/create?text={{'+location.href+'}}&action={{Stuff To Check Out}}|🔴 Reminder=fantastical2://parse?sentence={{'+location.href+'}}&reminder=1|🔒 Open In 1Password=op'+location.href+'|🔗 Clean Link=clean-links://x-callback-url/clean?url={{'+location.href+'}}]')
@mattcassinelli
mattcassinelli / App Store
Created February 2, 2014 07:49
Action list to open the App Store, search for a term, and open the Top Paid, Free, or Grossing charts.
http://[[list:App Store|Open=appstore.com/|Search=search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?media=software&term=[prompt:Query]|Top Paid=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=30|Top Free=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=27|Top Grossing=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=38]]
http://
[[
list:App Store
|Open=appstore.com/
|Search=search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?media=software&term=[prompt:Query]
|Top Paid=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=30
|Top Free=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=27
|Top Grossing=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=38
@mattcassinelli
mattcassinelli / Command+C–Clipboard
Created February 2, 2014 07:34
Command+C action to copy the Clipboard, send to the device first paired with Cmd+C, and return to Launch Center Pro
command-c://x-callback-url/copy?x-source={{Launch Center Pro}}&x-success={{launch://}}&deviceIndex=0
command-c://x-callback-url/copy?
x-source={{Launch Center Pro}}
&x-success={{launch://}}
&deviceIndex=0