Skip to content

Instantly share code, notes, and snippets.

View nevyn's full-sized avatar

Nevyn Bengtsson nevyn

View GitHub Profile
//
// NSImageGLTextureAdditions.h
// SkryllePhoto
//
// Created by Joachim Bengtsson on 2007-05-14.
// Copyright 2007 Joachim Bengtsson. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <OpenGL/gl.h>
@interface Base58Encoder : NSObject {
}
+ (NSString *)base58EncodedValue:(long long)num;
@end
11:36:03 nevyn:Desktop$ ccons
>>> #include <stdio.h>
>>> FILE *f = fopen("foo.txt", "w");
>>> fprintf(f, "hej\n");
=> (int) 4
>>> fflush(f);
=> (int) 0
// Here, I moved the file from the desktop to my home folder
11:36:03 nevyn:Desktop$ ccons
>>> #include <stdio.h>
>>> FILE *f = fopen("foo.txt", "w");
>>> fprintf(f, "hej\n");
=> (int) 4
>>> fflush(f);
=> (int) 0
// Here, I moved the file from the desktop to my home folder
@echo off
color 04
title .app to .ipa
cd >nul
set /p h=what is the name of the .app file:
md Payload\%h%
copy %h% Payload\%h%
echo.
echo.
echo ***********************************************
@nevyn
nevyn / wave.rb
Created July 22, 2009 15:38
Google wave ASCII art
#!/usr/bin/env ruby
# http://gist.github.com/152050
# thanks http://www.ascii-art.de/ascii/uvw/wave.txt
class Sprite
attr_accessor :data, :w, :h
def initialize w = 80, h = 23
@w = w
@h = h
#include <stdio.h>
#include <pthread.h>
#include <Foundation/Foundation.h>
typedef void (^LockedResourceWorker)(void *resource);
typedef void (^LockedResourceAcquirer)(LockedResourceWorker worker);
LockedResourceAcquirer LockedResource(void *resource)
{
NSLock *lock = [[NSLock new] autorelease];
Fri Oct 23 16:08:57 +0200 2009: PekpcJanitor janitor starting.
Fri Oct 23 16:08:57 +0200 2009: Failed weekly pekpc routine: Expected /u/apps/sgserv3/releases/20091021140949/app/models/pekpc_user.rb to define PekpcUser
<a href='txmt://open?url=file:///Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb&line=426'>/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:426:in `load_missing_constant'</a>
<a href='txmt://open?url=file:///Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb&line=80'>/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing'</a>
<a href='txmt://open?url=file:///Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb&line=92'>/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing'</a>
<a href='txmt://open?url=file:///Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/activ
0 com.apple.WebKit 0x00007fff84c64949 WTF::HashTableIterator<WTF::RefPtr<JSC::UString::Rep>, std::pair<WTF::RefPtr<JSC::UString::Rep>, JSC::Bindings::Method*>, WTF::PairFirstExtractor<std::pair<WTF::RefPtr<JSC::UString::Rep>, JSC::Bindings::Method*> >, WTF::StrHash<WTF::RefPtr<JSC::UString::Rep> >, WTF::PairHashTraits<WTF::HashTraits<WTF::RefPtr<JSC::UString::Rep> >, WTF::HashTraits<JSC::Bindings::Method*> >, WTF::HashTraits<WTF::RefPtr<JSC::UString::Rep> > > WTF::HashTable<WTF::RefPtr<JSC::UString::Rep>, std::pair<WTF::RefPtr<JSC::UString::Rep>, JSC::Bindings::Method*>, WTF::PairFirstExtractor<std::pair<WTF::RefPtr<JSC::UString::Rep>, JSC::Bindings::Method*> >, WTF::StrHash<WTF::RefPtr<JSC::UString::Rep> >, WTF::PairHashTraits<WTF::HashTraits<WTF::RefPtr<JSC::UString::Rep> >, WTF::HashTraits<JSC::Bindings::Method*> >, WTF::HashTraits<WTF::RefPtr<JSC::UString::Rep> > >::find<JSC::UString::Rep*, WTF::RefPtrHashMapRawKeyTranslator<JSC::UString::Rep*, std::pair<WTF::RefPtr<JSC::UString::Rep>, JSC
@nevyn
nevyn / TollFreeBridgedCpp.mm
Created April 8, 2010 21:58
Transparent ObjC<>C++ bridge
/*
Say you have a largeish C++ class. You want to use it from ObjC. ObjC++ is painful;
C++ is painful. .mm files are bad. How about if we could just treat that C++
object as an ObjC object whenever it exits C++ land?
Apple already solved this problem once with toll free bridging. The tricky part is
vtables -- with a vtable, isa isn't at offset 0 of the memory layout of the object.
The code below is a work in progress to work around this.
*/