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 <type_traits> | |
#include <iostream> | |
namespace std { | |
template <typename T> | |
using mut = typename std::remove_reference<T>::type&; | |
template <typename T> | |
constexpr mut<T> mutate(T& t) { |
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 main() { | |
std::vector<int> foo; | |
} |
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 <string> | |
#include <iostream> | |
#include <boost/asio.hpp> | |
#include <boost/algorithm/string.hpp> | |
#include <boost/bind.hpp> | |
using boost::asio::ip::udp; | |
namespace { |
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 <string> | |
#include <iostream> | |
#include <boost/asio.hpp> | |
#include <boost/bind.hpp> | |
using boost::asio::ip::udp; | |
namespace { | |
class HelloWorldServer { |
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 <cstdlib> | |
#include <list> | |
#include "mongo/client/dbclient.h" | |
#include "mongo/bson/bson.h" | |
namespace bson { | |
typedef mongo::BSONElement Element; | |
typedef mongo::BSONObj Obj; | |
typedef mongo::BSONObjBuilder Builder; |
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
// C++11 only | |
#if __cplusplus <= 201103L | |
#include <cstdlib> | |
#include <ctime> | |
#include <iostream> | |
#include <functional> | |
#include <memory> | |
#include <type_traits> |
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
use std::io::buffered::BufferedReader; | |
use std::io; | |
#[deriving(Clone)] | |
struct Todo { | |
desc: ~str, | |
completed: bool | |
} | |
impl Todo { |
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
module BloomHttpAPIExample | |
state do | |
http(:req, :resp) :hello_world, [:query_param1, :query_param2, ...] | |
end | |
bloom do | |
# we could also use some kind of template mechanism | |
hello_world.resp <= hello_world.req { |r| [["<html><p>Your ip is #{r.remote_addr}</p></html>"]] } | |
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
// compile with g++-4.7 -std=c++11 -pthread threadtest.cpp -o threadtest | |
#include <iostream> | |
#include <thread> | |
#include <cstdlib> | |
#include <chrono> | |
static const int num_threads = 10; | |
int main() { |
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
; O is a natural number. | |
(define zero 'zero) | |
; For every number n, (succ n) is a natural number. | |
(define (succ n) | |
(lambda () n)) | |
; A few numbers | |
(define one | |
(succ zero)) |
NewerOlder