Instantly share code, notes, and snippets.

Coffee coffee = new Coffee();
if(coffee.Empty) {
#!/usr/bin/env python
# Coded poorly by Brett Kelly
# @inkedmn
# -*- coding: utf-8 -*-
import urllib2
import urllib
import re
View NewMarkdownFile.applescript
property targetDir : "/Users/bkelly/Dropbox/Notes/"
property editorApp : "/Applications/"
on getNewFileName()
set fileName to (text returned of (display dialog "Enter the filename with extension" default answer ""))
return fileName
end getNewFileName
tell application "Byword"
set fname to my getNewFileName()
View get-two-ps.php
function get_two_paragraphs(){
global $post;
$str = wpautop( get_the_content() );
$psToGrab = 2; // number of paragraphs to get
$maxFirstParaLength = 200; // character max in first paragraph
$matches = array(); // matching elements will go here
$pattern = '%<p[^>]*>(.*?)</p>%i'; // match what's between all <p> tags
preg_match_all($pattern, $str, $matches); // do the regex match
View get-fisrt-paragraph.php
* Get first paragraph from a WordPress post. Use inside the Loop.
* @return string
function get_first_paragraph(){
global $post;
$str = wpautop( get_the_content() );
#!/usr/bin/env python
import re, sys
input = '%clipboard'
r = re.compile("!\[\]\(images\/([^.]+).png\)")
m = r.match(input)
if m:
outp = "<$img:%s>" % m.groups()[0]

I'm a blog post

I have Markdown syntax like bold

Can you diff me?

I have a new line of text with an image...

View NewMeeting.applescript
set myNotebook to "@Inbox"
set myTags to {"to_process"}
set myTitle to "Meeting Notes with "
set myContent to ""
tell application "Evernote"
set myNote to create note title myTitle with text myContent notebook myNotebook tags myTags
delay (1) -- give the note a sec to save
open note window with myNote
end tell
View foo.applescript
tell application "Evernote"
set myNote to selection
set myUrl to (source URL of item 1 of myNote)
tell application "System Events"
open location myUrl
end tell
on error
-- real programmers would put something here
end try