This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
module LibInit | |
@@libs = {} | |
def init_lib(lib) | |
@@libs[lib].call if @@libs[lib] | |
end | |
def to_init(lib, &block) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#define SET(expr, val) \ | |
expr *= val / expr + val; \ | |
expr += 3 * pow(abs(3), abs(3)) + pow(abs(3), pow(2, 2) - 1) - 10 / 2; | |
#define COEFF 2 : (str[i] * (8 / 16) * 2) + 2 | |
#define true ((str[i] * 2) - 'j') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableString *string = [[NSMutableString alloc] init]; | |
int readBytes = 0; | |
do { | |
uint8_t buf[MPD_LINE_MAX + 1]; | |
memset(buf, '\0', MPD_LINE_MAX + 1); | |
readBytes = [input read:buf maxLength:MPD_LINE_MAX]; | |
[string appendFormat:@"%s", buf]; | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef int (^complicated_block)(int, int); | |
typedef int (^simple_block)(int); | |
int main(int argc, char *argv[]) { | |
complicated_block pow = ^(int n, int power) { | |
int ret = 1; | |
for (int i = 0; i < power; i++) | |
ret *= n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
void sort_array(int *tab, int size, int (^block)(int var1, int var2)) { | |
while (1) { | |
int i, count = 0; | |
for (i = 0; i < size - 1; i++) { | |
if (block(tab[i], tab[i + 1]) > 0) { | |
int tmp = tab[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
void map_array(int *array, int size, int (^block)(int value)) { | |
for (int i = 0; i < size; i++) | |
array[i] = block(array[i]); | |
} | |
int main(int argc, char **argv) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
int inject_array(int *array, int size, int init, | |
int (^block)(int sum, int value)) { | |
for (int i = 0; i < size; i++) | |
init = block(init, array[i]); | |
return init; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string = Instruments.translate do | |
self.view = main_window.find_table_view("test") | |
self.cell = self.view.find_cell(0) | |
self.elem = self.cell.find_element("Chocolate Cake") | |
self.but = self.navigation_bar.find_button("Add") | |
but.tap | |
self.name = "Turtle Pie" | |
find_text_field(0).value = name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIALogger.logStart("Show add server dialog"); | |
try { | |
UIATarget.localTarget().frontMostApp().navigationBar().buttons()["Add"].tap(); | |
UIATarget.localTarget().captureScreenWithName("make_a_screenshot"); | |
UIALogger.logPass("Show add server dialog"); | |
} | |
catch(error) { | |
UIALogger.logError(error); | |
UIALogger.logFail("Show add server dialog"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <Block.h> | |
typedef BOOL (^SpecTestBlock)(NSObject *obj); | |
typedef NSString *(^SpecErrorBlock)(NSObject *obj); | |
@interface SpecMatcher : NSObject { | |
SpecTestBlock testBlock; | |
SpecErrorBlock errorBlock; |