Skip to content

Instantly share code, notes, and snippets.

View johanforssell's full-sized avatar

Johan Forssell johanforssell

  • NaN
  • Sweden
  • 05:44 (UTC +01:00)
View GitHub Profile
@johanforssell
johanforssell / KiwiBlocksRally
Created February 17, 2014 09:28
Helpful trio of macros to make sure your asynchronous blocks are run in a Kiwi spec file.
#pragma mark - Kiwi Blocks rally
// 1/3: Invoke at start of test
#define BlocksRallyStart(_a) \
NSInteger _blocks_total = _a; __block NSInteger _blocks_counter = 0;
// 2/3: Invoke in each block you're waiting for
#define BlocksRallyCheckpoint \
_blocks_counter += 1;
@johanforssell
johanforssell / gist:8237848
Last active January 2, 2016 02:29
Simple web server which accepts chunked uploads and responds with a dummy json
#!/usr/bin/python
import time
import BaseHTTPServer
import json
from pprint import pprint
HOST_NAME = '192.168.1.89'
PORT_NUMBER = 9494
media_results = {
@johanforssell
johanforssell / gist:5386976
Created April 15, 2013 09:29
Shell-alias 'week' för att kolla med http://vecka.nu vilken vecka det är. Kommer att gå sönder när de designar om sidan.
alias week="curl --silent --url http://vecka.nu | egrep '<div style=\"color: #066EB0; font-family: Arial; font-size: 220pt; line-height: 220pt; font-weight: bold;\">[0-9]*</div>' | sed -e 's/.*>\([0-9]*\)<.*/\1/'";