This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/node | |
// PBS 12/5/13 | |
// This is a BBEdit text filter for indenting (and beautifying) JavaScript. | |
// It goes in ~/Library/Application Support/BBEdit/Text Filters/ | |
// | |
// On my machine I assigned it a keyboard shortcut: cmd-' | |
// | |
// It requires the js-beautify Node module: https://github.com/einars/js-beautify | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# PBS 4 Dec. 2013 | |
# Renders HTML for all the .markdown files in the current directory. | |
# Gives each file a .html suffix. | |
# Saves them in a subfolder called HTML. | |
require 'rdiscount' | |
require 'find' | |
require 'fileutils' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UITextView (RSExtras) | |
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) { | |
/*[s length] is assumed to be 0 or 1. s may be nil. | |
Totally not a strict check.*/ | |
if (s == nil || [s length] < 1) | |
return NO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import os | |
from urllib import urlencode | |
import subprocess | |
# setClipboardData is from <http://www.macdrifter.com/2011/12/python-and-the-mac-clipboard/>*/ | |
def setClipboardData(data): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL RSIsEmpty(id obj) { | |
return obj == nil || obj == [NSNull null] || ([obj respondsToSelector:@selector(length)] && [(NSData *)obj length] == 0) || ([obj respondsToSelector:@selector(count)] && [obj count] == 0); | |
} | |
BOOL RSStringIsEmpty(NSString *s) { | |
/*22 Feb. 2011: added NSNull check. JSON parser can put a null where we expect a string, and NSNull throws an exception when checking length. Since [NSNull null] is, arguably, emptiness, it makes sense to include it.*/ | |
return s == nil || (id)s == (id)[NSNull null] || [s length] == 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIResponder (RSCore) | |
- (BOOL)rs_performSelectorViaResponderChain:(SEL)aSelector withObject:(id)anObject { | |
UIResponder *nomad = self; | |
while (nomad != nil) { | |
if ([nomad respondsToSelector:aSelector]) { | |
[nomad performSelector:aSelector withObject:anObject]; | |
return YES; | |
} | |
nomad = [nomad nextResponder]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)thingWasTapped:(UIGestureRecgonizer *)gestureRecognizer { | |
[self rs_performSelectorViaResponderChain:@selector(myRealAction:) withObject:gestureRecognizer.view]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# Prints the directory names and hg status output for any Mercurial | |
# repositories where hg status returns something non-nil. | |
# | |
# Assumes everything is in a Projects directory in your home folder. | |
# 12/31/2011 Brent Simmons | |
require 'find' | |
require 'open3' |
NewerOlder