Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt H matthewhochler

View GitHub Profile
@matthewhochler
matthewhochler / command.js
Last active Jan 1, 2016 — forked from JoelBesada/README.md
Bookmark current URL in Pinboard, with pop-up window. Custom bookmarklet for Backtick (http://backtick.io/).
View command.js
javascript:q=location.href;if(document.getSelection){d=document.getSelection();}else{d='';};p=document.title;void(open('https://pinboard.in/add?url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=700,height=350'));
@matthewhochler
matthewhochler / command.js
Last active Jan 1, 2016
Bookmark current URL in Pinboard as 'Unread,' with no pop-up or option for tags. Custom bookmarklet for Backtick (http://backtick.io/).
View command.js
javascript:q=location.href;p=document.title;void(t=open('https://pinboard.in/add?later=yes&noui=yes&jump=close&url='+encodeURIComponent(q)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=100,height=100'));t.blur();
@matthewhochler
matthewhochler / command.js
Created Dec 26, 2013
Custom bookmarklet for Backtick (http://backtick.io/). Add current site's RSS to Feed Wrangler.
View command.js
javascript:javascript:%20(function%20()%20{var%20jsCode%20=%20document.createElement(%27script%27);jsCode.setAttribute(%27src%27,%20%27https://feedwrangler.net/add_bookmarklet.js%27);document.body.appendChild(jsCode);}());
@matthewhochler
matthewhochler / add_to_omnifocus-oneliner.js
Last active Jan 4, 2016 — forked from al3xandru/gist:1169583
Add to OmniFocus Bookmarket
View add_to_omnifocus-oneliner.js
javascript:(function(){var enc=encodeURIComponent,w=window,frames=w.frames,d=document,tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pu=w.location.href,isGMail=w.location.host.match(/mail\.google\.com/),tt=pt=d.title,subjSpans=d.getElementsByClassName("hP"),i,url;if(isGMail){if(subjSpans){tt=subjSpans[0].innerText}else{tt=d.title.substring(d.title.indexOf("-")+1,d.title.lastIndexOf("-")).replace(/^ +/,"").replace(/ +$/,"")};if(tn!="")tn+="\n\n";tn+="From email subject:("+tt+")\n"+pu;pu="https://mail.google.com/mail/u/0/?qs=true&search=query&q=subject:("+enc(tt)+")"};url='omnifocus:///add?note='+enc(tn+"\n"+pu)+'&name='+enc(tt);w.location.href=url})();
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@matthewhochler
matthewhochler / omnifocus_bookmarklet.js
Last active Aug 29, 2015 — forked from al3xandru/gist:1169583
OmniFocus Generalized Bookmarklet
View omnifocus_bookmarklet.js
javascript:(function(){
var enc=encodeURIComponent,
w=window,
frames=w.frames,
d=document,
tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),
pu=w.location.href,
isGMail=w.location.host.match(/mail\.google\.com/),
tt=pt=d.title,
subjSpans=d.getElementsByClassName("hP"),i,url;
View create_project.sh
#!/bin/bash
# Setup deployment target for Nginx + Python/uWSGI + Supervisor + Git
# From: https://gist.github.com/1210041
function usage() {
cat << EOF
Usage: $0 PROJECT_NAME [DOMAIN] [OPTIONS]
Options:
-y No prompts, assume yes to all.
View profile_middleware.py
import sys
import tempfile
import hotshot
import hotshot.stats
from django.conf import settings
from cStringIO import StringIO
class ProfileMiddleware(object):
"""
Displays hotshot profiling for any view.
@matthewhochler
matthewhochler / search_google_in_duckduckgo.js
Created Jan 28, 2015
Bookmarklet to search Google from a DuckDuckGo results page
View search_google_in_duckduckgo.js
javascript:(function()%7B$('%23search_form_input').val('!g '+$('%23search_form_input').val());$('%23search_form').submit();%7D)()
@matthewhochler
matthewhochler / inline_todoist.js
Created Jan 28, 2015
Inline Todoist interface bookmarklet.
View inline_todoist.js
javascript: (function() %7B var doc = top.document; if(top.js && top.js.document) doc = top.js.document; var script = doc.createElement('script'); doc.todoist_script = script; script.type = 'text/javascript'; script.src = 'http://todoist.com/anywhere/getJavaScript'; doc.getElementsByTagName('head')%5B0%5D.appendChild(script); %7D)(); void(0);