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 <vector> | |
#include <iostream> | |
#include <functional> | |
#include <iterator> | |
template <class Functor> | |
class Not | |
{ | |
public: | |
Not(Functor & f) : func(f) {} |
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 <map> | |
#include <sstream> | |
#include <string> | |
#include <iterator> | |
template <class T, class C, class charT=char, class traits=std::char_traits<charT> > | |
class ostream_cast_iterator : | |
public std::iterator<std::output_iterator_tag, void, void, void, void> | |
{ |
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 <ctime> | |
#include <iterator> | |
// old stuff | |
template<typename DataType, int NumComponents, typename Derived> | |
struct composite_base { | |
typedef DataType value_type; | |
static const int num_components = NumComponents; | |
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); |
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 <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
#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
@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
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
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 |
OlderNewer