This file contains 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
#!/usr/bin/env ruby | |
require 'erb' | |
require 'open3' | |
# == Code generation ==================================================================================== | |
def scenario_multi_call(callsite_count) | |
ERB.new(<<-HERE).result(binding) | |
#include "continuable/continuable.hpp" |
This file contains 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
int hash(const char *data) { | |
const char *pos = data; | |
int bit_num = 1; | |
int xored = 0; | |
while (*pos) { | |
int value = (int)*pos << bit_num; | |
int msb = value >> 15; | |
value = (value & 0x7FFF) | msb; |
This file contains 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 <iostream> | |
int main() { | |
std::cout << &1["strump"] << std::endl; | |
} |
This file contains 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
def esc(text) | |
text.upcase | |
end | |
def esc_sub(text, patterns) | |
patterns.each do |pattern, replacement| | |
if text =~ /^(.*)#{pattern}(.*)$/ | |
return [esc_sub($1, patterns), replacement, esc_sub($2, patterns)].join | |
end | |
end |
This file contains 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
nums = (1..3).to_a | |
nums.zip(nums.drop(1)).map { |_, x2| x2 } #=> [2, 3, nil] |
This file contains 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
@implementation NSArray (FunctionalKit) | |
- (NSDictionary *)collectWithBlock:(id (^)(id value)) valueIdentifier { | |
NSMutableDictionary *dict = [NSMutableDictionary new]; | |
for (id object in self) { | |
id ident = valueIdentifier(object); | |
NSMutableArray *array = [dict objectForKey:ident]; | |
if (!array) { |
This file contains 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 <inttypes.h> | |
typedef struct node { | |
void *link; | |
int value; | |
} node_t; | |
#define LINK(prev, next) (void *)((uintptr_t)(prev) ^ (uintptr_t)(next)) |
This file contains 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 <iostream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
namespace { | |
std::string rotl(const std::string &s) { | |
return s.substr(1) + s.at(0); | |
} | |
} |
This file contains 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
alias mkc "mkdir \!^ && cd \!^" | |
alias mkt 'cd `~/bin/mktest`' |
This file contains 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> | |
GLOBAL_SYM(add); | |
%> | |
val my_printer = fun(a) => <%|a| | |
printf("--> %p\n", a); | |
//RET(string_object("en katt")); | |
object_t params = array_object(1); |
NewerOlder