Skip to content

Instantly share code, notes, and snippets.

View mysteriouspants's full-sized avatar
:shipit:
Help! I'm trapped in a fixed-width str

Christopher R. Miller mysteriouspants

:shipit:
Help! I'm trapped in a fixed-width str
View GitHub Profile
@mysteriouspants
mysteriouspants / gist:3919588
Created October 19, 2012 17:46
TorqueBox Assets Puke
Started GET "/assets/ikit.css" for 127.0.0.1 at 2012-10-19 11:46:30 -0600
11:46:30,532 INFO [cuttlefish] (http-localhost/127.0.0.1:8080-1) Served asset /ikit.css - 304 Not Modified (77ms)
11:46:30,537 INFO [cuttlefish] (http-localhost/127.0.0.1:8080-2)
Started GET "/assets/jquery.js" for 127.0.0.1 at 2012-10-19 11:46:30 -0600
11:46:30,558 INFO [cuttlefish] (http-localhost/127.0.0.1:8080-2) Served asset /jquery.js - 404 Not Found (15ms)
11:46:30,567 FATAL [cuttlefish] (http-localhost/127.0.0.1:8080-2)
ActionController::RoutingError (No route matches [GET] "/assets/jquery.js"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
@mysteriouspants
mysteriouspants / gist:3802133
Created September 28, 2012 21:18
NSContainers+PrettyPrint Sample Output
Before swizzling:
<ExObj:0x7fc098415140
_ivar0 = Foo
_ivar1 = 42
_ivar2 = {
anotherObject = "<ExObj:0x7fc098414d80\n _ivar0 = Bar\n _ivar1 = 1\n _ivar2 = {\n }>";
}>
After swizzling:
<ExObj:0x7fc098415140
@mysteriouspants
mysteriouspants / gist:3802114
Created September 28, 2012 21:15
FSArgumentParser Sample Code
#import <Foundation/Foundation.h>
#import "FSArguments.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
FSArgumentSignature * helpFlag = [FSArgumentSignature argumentSignatureWithFormat:@"[-h --help]"];
FSArgumentSignature * inFileFlag = [FSArgumentSignature argumentSignatureWithFormat:@"[-i --in-file]={1,}"];
FSArgumentSignature * outFileFlag = [FSArgumentSignature argumentSignatureWithFormat:@"[-o --out-file]="];
NSSet * signatures = [NSSet setWithObjects:helpFlag, inFileFlag, outFileFlag, nil];
@mysteriouspants
mysteriouspants / gist:3802099
Created September 28, 2012 21:13
FSURLOperation Example
NSURLRequest* req= [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://fsdev.net"]];
__block NSData* mySite= nil;
FSURLOperation* oper= [FSURLOperation URLOperationWithRequest:req completionBlock:^(NSHTTPURLResponse* resp, NSData* payload, NSError* asplosion) {
mySite = payload;
}];
NSBlockOperation* onFinish= [NSBlockOperation blockOperationWithBlock:^{
NSMutableURLRequest* spamReq= [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.fsdev.net/"]];
@mysteriouspants
mysteriouspants / Rakefile
Created September 21, 2012 15:45
My blog's Rakefile
HOOLIGAN_STYLES={
'themes/hooligan/stylesheets/_sass/style.scss' => 'themes/hooligan/stylesheets/css/style.css'
}
module Rake
class Task
def has_dependency? task, inspected_tasks=[]
task= Rake::Task[task] if task.class != Rake::Task
return true if self == task
return false if inspected_tasks.include? self
@mysteriouspants
mysteriouspants / 193_behavior.txt
Created August 13, 2012 22:00
Somewhere in Sprockets an encoding bug has reared its ugly head!
Last login: Mon Aug 13 15:54:31 on ttys005
Welcome back, commander!
cmiller@cmiller-iMac:~
> which irb
/Users/cmiller/.rvm/rubies/ruby-1.9.3-p194/bin/irb
cmiller@cmiller-iMac:~
@mysteriouspants
mysteriouspants / extconf.rb
Created August 1, 2012 19:00
Extconf for therubyracer v0.10.1 or so
require 'mkmf'
require 'set'
begin
require 'libv8'
rescue LoadError
require 'rubygems'
require 'libv8'
end
have_library('objc') if RUBY_PLATFORM =~ /darwin/
@mysteriouspants
mysteriouspants / foo.m
Created May 11, 2012 15:52
Save app delegates everywhere by shoving static data into C functions!
NSDictionary * sharedFoo() {
static NSDictionary * foo;
static dispatch_once_t f;
dispatch_once(f, ^{
foo = [NSDictionary dictionaryWithObjectsForKeys:
@"bar", @"foo"];
};
return foo;
}
@mysteriouspants
mysteriouspants / COADocumentWindowController.m
Created April 17, 2012 18:30
Basic drag'n'drop functionality.
//
// COADocumentWindowController.m
// Co-Author
//
// Created by Christopher Miller on 4/13/12.
// Copyright (c) 2012 FSDEV. All rights reserved.
//
#import "COADocumentWindowController.h"
#import "COAManagedNode.h"
@mysteriouspants
mysteriouspants / Would You Kindly.txt
Created March 6, 2012 21:26
Would you kindly fix Radar? (duplicate of rdar://10993759)
Dear Apple,
We need to talk. We love your software, we really do. Or maybe we don't but we want to tell you why
so you can try to improve it. We are developers ourselves and we know how hard it is to write
software, to find and fix bugs, to know what your users want from your software. We want to file bug
reports and feature requests for every bug we find or feature we think of. As a community we want you
to know what is important to us, in a way that doesn't require you to trawl through countless blogs
and tweets. Unfortunately you're making it so incredibly hard to do so.
The only way to really communicate with Apple about what is broken and what we want is Radar. But