Skip to content

Instantly share code, notes, and snippets.

@wellle
wellle / AdView.h
Created October 9, 2012 14:35
A simple pseudo advertising banner view that illustrate how tracking could be handled in combination with the SKProductViewController in iOS6.
#import <UIKit/UIKit.h>
// We need store kit to use the product view controller.
#import <StoreKit/StoreKit.h>
// This is a minimal example of a pseudo advertising banner view.
// It is meant to illustrate how tracking could be handled in
// combination with the new product view controller in iOS6. The main
// mechanism is the callback to a callback URL with an advertising ID.
@interface AdView : UIView <SKStoreProductViewControllerDelegate>
@wellle
wellle / welle.vimrc
Created November 1, 2012 15:00
my current vimrc
set nocompatible
syntax enable
set hidden
" set noesckeys " messes up the mouse
" set timeoutlen=0 " messes up mappings
set ttimeoutlen=50
set shortmess=atI
set scrolloff=2
@wellle
wellle / reject.go
Last active December 15, 2015 20:29
Small go program to demonstrate a case for https://github.com/streadway/amqp/pull/56. Using the adeven fork, the program prints `Sucess! Body: payload`. Using streadway/amqp, the program prints `Get failed: Exception (501) Reason: "EOF"` Requirements: Local amqp server with a queue and a corresponding dead letter queue. Both should be empty.
package main
import (
"github.com/adeven/amqp" // `adeven` works, `streadway` doesn't
"log"
"time"
)
func main() {
amqpConfig := "amqp://guest:guest@localhost:5672/"
package main
import (
"launchpad.net/gocheck"
)
type containsChecker struct {
*gocheck.CheckerInfo
}
@wellle
wellle / mbfcsstl.patch
Created June 3, 2013 21:20
support multi-byte 'fillchars' in custom 'statusline' https://groups.google.com/forum/#!topic/vim_dev/0Cta0HGEHI8
diff -r 99b2236c037c src/buffer.c
--- a/src/buffer.c Mon Jun 03 12:17:05 2013 +0200
+++ b/src/buffer.c Mon Jun 03 16:23:39 2013 +0200
@@ -3567,11 +3567,6 @@
if (fillchar == 0)
fillchar = ' ';
-#ifdef FEAT_MBYTE
- /* Can't handle a multi-byte fill character yet. */
- else if (mb_char2len(fillchar) > 1)
@wellle
wellle / gist:5783452
Created June 14, 2013 16:45
Added tag v7-3-1189 for changeset dc78a26f6f64
src hg:default ❱ make
mkdir objects
CC="gcc -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp " srcdir=. sh ./osdef.sh
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/buffer.o buffer.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/blowfish.o blowfish.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/charset.o charset.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/diff.o diff.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/digraph.o digraph.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/edit.o edit.c
~ ❱ gcc -dM -E - < /dev/null
#define OBJC_NEW_PROPERTIES 1
#define _LP64 1
#define __APPLE_CC__ 5621
#define __APPLE__ 1
#define __ATOMIC_ACQUIRE 2
#define __ATOMIC_ACQ_REL 4
#define __ATOMIC_CONSUME 1
#define __ATOMIC_RELAXED 0
#define __ATOMIC_RELEASE 3
@wellle
wellle / gist:5796507
Created June 17, 2013 12:27
Ant build failure
sergio:~/git/Android-App$ ant
Buildfile: /Users/sergio/git/Android-App/build.xml
...bla bla bla...
-set-mode-check:
-set-release-mode:
-release-obfuscation-check:
@wellle
wellle / AppDelegate.m
Last active December 19, 2015 09:49
Small class that adds itself as observer, but never removes itself again.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// ...
Terminate *terminate = [[Terminate alloc] init];
[terminate release];
return YES;
}
@wellle
wellle / ascenders.c
Last active December 19, 2015 23:18
Regarding the ascenders problem from codility.com.
#include <stdio.h>
#include <stdlib.h>
struct Results {
int * R;
int N;
};
struct Results solution(int A[], int N) {
struct Results result;