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 <Windows.h> | |
namespace w32 { namespace tp { | |
class Hints; | |
class Queue; | |
// Dispatches calls to a function with a painful signature (see PTP_TIMER). | |
class Timer | |
{ |
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
// partial_sort() implementation for std::list<int> based on suggestion | |
// by Scott Meyers in Effective STL, item 31. | |
// | |
// See <http://stackoverflow.com/questions/9220750>. | |
#include <cstddef> | |
#include <list> | |
#include <iostream> | |
#include <set> |
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
@echo off | |
call:factorial "%~1" | |
echo result: %ErrorLevel% | |
exit /b 0 | |
:factorial | |
if "%~1" LEQ "2" ( | |
set ErrorLevel=%~1 | |
exit /b 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
namespace { | |
// redirect outputs to another output stream. | |
class redirect_outputs | |
{ | |
std::ostream& myStream; | |
std::streambuf *const myBuffer; | |
public: | |
redirect_outputs ( std::ostream& lhs, std::ostream& rhs=std::cout ) | |
: myStream(rhs), myBuffer(myStream.rdbuf()) |
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
// Parses headers just like it did before, but allows custom handling | |
// for body contents. Just inherit and implement 'accept_body()' to | |
// suit your needs. | |
class Request | |
{ | |
// Same as before, minus the 'myBody' string. | |
// ... | |
protected: | |
// Implement in derived classes for custom body handling. |
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
class RequestHeaders : | |
public Request | |
{ | |
protected: | |
virtual void accept_body ( const char *, std::size_t ) {} | |
}; | |
class ResponseHeaders : | |
public Response | |
{ |
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
@echo off | |
git-ls-all-submodules | zip -@ ../source-code.zip |
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
std::vector<int> multiply (std::vector<int> input, int value) | |
{ | |
for (auto& i : input ) | |
i *= value; | |
return input; | |
} | |
int main (int, char**) | |
{ | |
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
@echo off | |
rem -- Unix "which" utility. | |
rem -- | |
rem -- Usage: which <program> | |
rem -- Shows absolute path to "program", if it exists. | |
rem -- | |
rem -- The utility can find any program that satisfies all of these conditions: | |
rem -- 1) the program's extension is registered in %PathExt%; | |
rem -- 2) the program is found under a folder in %Path%. | |
rem -- |
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
# -*- coding: utf-8 -*- | |
from pyramid.config import Configurator | |
from cornice.resource import resource, view | |
from webtest import TestApp | |
@resource(path='/hello') | |
class Hello(object): | |
def __init__(self, request): | |
self.request = request |
OlderNewer