Skip to content

Instantly share code, notes, and snippets.

View Kentzo's full-sized avatar
🤖

Ilya Kulakov Kentzo

🤖
View GitHub Profile
*.pbxproj -crlf -diff -merge
void RMPrintError(NSError* error){
NSArray* errors = [[error userInfo] valueForKey:@"NSDetailedErrors"];
if(errors != nil){
for(NSError* nestedError in errors){
NSLog(@"%@", [nestedError userInfo]);
}
}
else{
NSLog(@"%@", error);
}
NSDocumentController* documentContr = [NSDocumentController sharedDocumentController];
NSWindowController* windowContr = [[[documentContr documents] objectAtIndex:0] browserWindowController];
NSWindow* window = [windowContr window];
NSToolbar* toolbar = [window toolbar];
[toolbar insertItemWithItemIdentifier:[[SWMPluginController sharedInstance] toolbarButtonIdentifier]
atIndex:[[SWMPluginController sharedInstance] toolbarButtonIndex]];
@implementation CustomToolBarButtonExtension
+ (BOOL)loadExtension:(NSError**)error { // Is called in +load function
Class origClass = NSClassFromString(@"ToolbarController");
class_addMethodsFromClass(origClass, self);
BOOL result = [origClass jr_swizzleMethod:@selector(toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:)
withMethod:@selector(SWMToolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:) error:error] &&
[origClass jr_swizzleMethod:@selector(toolbarAllowedItemIdentifiers:)
withMethod:@selector(SWMToolbarAllowedItemIdentifiers:) error:error];
2010-04-20 20:43:16.517 redmineManager[70691:4a1b] PUT -> http://yohannshouse.ath.cx/issues.xml
2010-04-20 20:43:16.518 redmineManager[70691:4a1b] <issue><project_id>1</project_id><subject>Test Namerr</subject><description>Test yyfff</description></issue>
2010-04-20 20:43:19.422 redmineManager[70691:4a1b] <= <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Action Controller: Exception caught</title>
<style>
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
#define R 15 // исходные элементы - 15битные
#define E 4 // 4 бита под экспоненты, так как 23 <= R < 24
// S[i] - беззнаковые числа
for (i=0; i<N; i++) { // С каждым элементом исходного блока
j=0;
while (S[i] >= 1<<j) j++; // Найдем такое j, что S[i] < (1 << j)
E[i]=j; // запишем j, т.е. порядок числа S[i] в массив E
if (j>1)
/*
Error-free way to work with NSFetchedResultsController
*/
/**
Delegate methods of NSFetchedResultsController to respond to additions, removals and so on.
*/
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
// The fetch controller is about to start sending change notifications, so prepare the table view for updates.
if ([self class] == [FBPermissionDialog class]) {
NSData *body = [request HTTPBody];
if (body != nil) {
NSString *httpBody = [NSString stringWithUTF8String:[[request HTTPBody] bytes]];
NSRange range = [httpBody rangeOfString:@"Don%27t+Allow"];
if (range.location != NSNotFound) { // User clicks on "don't allow"
[self dismissWithSuccess:NO animated:YES];
}
}
}
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
/*
...
*/
//use a custom runloop
static NSString *runLoopMode = @"com.me.myloop";
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:runLoopMode];
[connection start];
while (![connectionDelegate isDone] && ![self isCancelled]) {
#import "MABaseFuture.h"
#import <libkern/OSAtomic.h>
@implementation MABaseFuture
@dynamic futureValue;
@synthesize futureHasResolved = _resolved;
- (id)futureValue
{