Skip to content

Instantly share code, notes, and snippets.

//
// AppDelegate.m
// MouseTest
//
// Created by Seth Willits on 1/30/14.
// Copyright (c) 2014 Araelium Group. All rights reserved.
//
#import "AppDelegate.h"
void *Sys_LoadDll( const char *name, char *fqpath,
int( **entryPoint ) ( int, ... ),
int ( *systemcalls )( int, ... ) ) {
void *libHandle;
void ( *dllEntry )( int ( *syscallptr )( int, ... ) );
char fname[MAX_OSPATH];
char *pwdpath;
char *homepath;
char *basepath;
char *gamedir;
graph "Seth's Graph" {
graph [dpi=72,
overlap=orthoxy,
sep=0.27777,
splines=false
];
node [fixedsize=1,
height=0.5,
label="\N",
shape=box,
//
// APTokenSearchField.h
// TokenFieldTest
//
// Created by Seth Willits on 12/4/13.
// Copyright (c) 2013 Araelium Group. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@implementation AppDelegate
{
AGApplicationMoved * _moved;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
_moved = [[AGApplicationMoved watchForApplicationMoving:^{
#import <Foundation/Foundation.h>
void eachrow(size_t total, size_t nrows, size_t ncols, char const*** rows, BOOL(^cb)(size_t i, size_t ncols, char const **row, size_t *lengths))
{
size_t lengths[ncols];
for (size_t k = 0; k < total; ++k)
{
size_t i = k % nrows;
for (size_t j = 0; j < ncols; ++j)
{
@interface NSMenu (SeparatorAdditions)
- (void)removeExtraSeparatorItems;
@end
@implementation NSMenu (SeparatorAdditions)
- (void)removeExtraSeparatorItems;
{
// Remove separator at index 0
while (self.itemArray.count > 0) {
//
// main.c
//
#include <stdio.h>
#include "Game.h"
int main(int argc, const char * argv[])
{
Game * game = NewGame();
void MethodSwizzle(Class c, SEL orig, SEL new)
{
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if (class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) {
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
} else {
method_exchangeImplementations(origMethod, newMethod);
}
}
dispatch_source_t dispatch_coalesce_source_create(dispatch_queue_t queue)
{
dispatch_source_t src = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_resume(src);
return src;
}
void dispatch_coalesce(dispatch_source_t src, double time, void (^block)(void))
{