My Recent Pastes (633 and counting)
Pastes by Allan Odgaard (633 and counting)
Below are the 15 most recent pasties by Allan Odgaard.
December 17, 2009
5:58PM EDT
by Allan Odgaard
View more (79 lines)
def width(text, regexp) text.to_a.map { |line| if line =~ regexp then $&.length; else 0; end }.max end def align(text, regexp, width)
December 08, 2009
9:11AM EDT
by Allan Odgaard
View more (37 lines)
=begin
1. robust
a) ensure data on disk is always in a good state (atomic saving), ensure disk is relatively up to date with state
b) ensure bot gracefully reconnects if kicked etc.
2. async. session-based plug-ins
March 27, 2009
11:54AM EDT
by Allan Odgaard
View more (9 lines)
#include <dlfcn.h> int main (int argc, char const* argv[]) { void* p1 = dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LOCAL|RTLD_NOW);
February 14, 2009
4:13PM EDT
by Allan Odgaard
View more (27 lines)
#import <Foundation/Foundation.h> int main (int argc, char const* argv[]) { NSAutoreleasePool* pool = [NSAutoreleasePool new];
November 22, 2008
4:16AM EDT
by Allan Odgaard
View more (9 lines)
Please make `NSWindowCollectionBehaviorMoveToActiveSpace` the default window collection behavior. I am not a user of Spaces myself, but I receive bug reports for windows where I forget to set the behavior, so definitely `…MoveToActiveSpace` is what users expect, and logically I can’t see why this would not be so. Having application developers set this is bad because:
May 29, 2008
7:16AM EDT
by Allan Odgaard
View more (37 lines)
--- docset_query.rb (original) +++ docset_query.rb @@ -1,5 +1,4 @@ SUPPORT = ENV['TM_SUPPORT_PATH'] -DIALOG = SUPPORT + '/bin/tm_dialog'
May 27, 2008
9:28AM EDT
by Allan Odgaard
View more (35 lines)
Index: Commands/Lookup Cocoa Class.plist =================================================================== --- Commands/Lookup Cocoa Class.plist (revision 9547) +++ Commands/Lookup Cocoa Class.plist (working copy) @@ -5,7 +5,12 @@
May 27, 2008
9:24AM EDT
by Allan Odgaard
View more (35 lines)
Index: Commands/Lookup Cocoa Class.plist =================================================================== --- Commands/Lookup Cocoa Class.plist (revision 9547) +++ Commands/Lookup Cocoa Class.plist (working copy) @@ -5,7 +5,12 @@
May 01, 2008
6:11AM EDT
by Allan Odgaard
View more (501 lines)
# Wrapping in TextMate: It would be nice if we could get indented soft wrap in TextMate. To that end I'm making this list of all the different types of wrapping we may want to support, and some explanations of what type of flexibility is needed. ## Markdown:
March 31, 2008
7:07AM EDT
by Allan Odgaard
View more (26 lines)
- (void)drawRect:(NSRect)aRect { NSEraseRect(aRect); NSFont* font = [NSFont controlContentFontOfSize:[NSFont systemFontSize]];
December 06, 2007
1:43PM EDT
by Allan Odgaard
View more (18 lines)
Index: newplistlib.py =================================================================== --- newplistlib.py (revision 8619) +++ newplistlib.py (working copy) @@ -191,8 +191,12 @@
December 05, 2007
10:28AM EDT
by Allan Odgaard
View more (49 lines)
The /etc/profile script (called by default by all users’ shell startup) has the following lines: if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi
November 29, 2007
10:46PM EDT
by Allan Odgaard
View more (9 lines)
#!/usr/bin/env ruby -wKU trap('SIGINT') { STDERR << "#{Time.now} ← receive\n" } fork { sleep 0.5; STDERR << "#{Time.now} ← send\n"; Process.kill('SIGINT', Process.ppid) }
November 02, 2007
2:37PM EDT
by Allan Odgaard
View more (37 lines)
#!/usr/bin/env ruby -wKU require ENV['TM_SUPPORT_PATH'] + '/lib/escape.rb' require 'erb' require 'open-uri' require 'net/http'
October 28, 2007
4:44PM EDT
by Allan Odgaard
View more (28 lines)
# Terminal should set LC_CTYPE rather than LANG By default Terminal sets LANG at startup (Preferences → Advanced). The intent here I assume is to get the various shell commands to work with UTF-8, which is great, since file names (and thus `ls` output) are UTF-8 and so is keyboard input.
