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> | |
/* #define FOO 33 */ | |
#ifdef FOO | |
# pragma push_macro ("FOO") | |
# define FOO_WRAPPED | |
# undef FOO | |
#endif |
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
/* g++ -std=c++11 wrap.cc */ | |
#include <functional> | |
#include <algorithm> | |
#include <vector> | |
#include <iterator> | |
#include <iostream> | |
typedef std::function<void ()> Action; | |
typedef std::function<void (Action)> Context; |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <iterator> | |
#include <utility> | |
class binheap { | |
std::size_t heap_size; | |
static std::size_t heap_parent (std::size_t 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
{-# LANGUAGE ScopedTypeVariables #-} | |
module MergeSort where | |
import Control.Monad.ST | |
import Control.Monad (forM_, when) | |
import Data.Array.ST | |
import Data.STRef | |
-- Required for tests only |
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 <glib.h> | |
#include <gio/gio.h> | |
#include <string.h> | |
static GMainLoop *gMainLoop = NULL; | |
char * | |
decode (GFileMonitorEvent ev) | |
{ | |
char *fmt = g_malloc0 (1024); |
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 Data.List (isSuffixOf) | |
import Data.Char (ord) | |
import Control.Monad (forM) | |
import System.IO (IOMode(..), withFile, hPutStrLn) | |
import System.FilePath (dropExtension) | |
import System.Directory (getDirectoryContents) | |
target :: FilePath -> Bool | |
target p = ".htm" `isSuffixOf` p |
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
(>>?) :: (Ord a, Num a) => Maybe a -> (a -> Maybe b) -> Maybe b | |
Nothing >>? _ = Nothing | |
Just v >>? f = if v > 0 then f v else Nothing | |
decr :: Int -> Maybe Int | |
decr a = Just (a - 1) | |
ex1 = (Just 1) >>? decr >>? decr >>? decr |
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
module ChainedHash | |
( | |
createHash | |
, with | |
, without | |
, withMany | |
, withoutMany | |
, at | |
) where |
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 <windows.h> | |
#include <stdio.h> | |
#include <stdarg.h> | |
static CRITICAL_SECTION crit; | |
void log_init() | |
{ | |
static volatile LONG done = 0; | |
if (done == 0) { |
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 <glib.h> | |
#include <glib/gprintf.h> | |
#include <gio/gio.h> | |
#include <string.h> /* memset, strlen */ | |
#include <stdlib.h> /* system */ | |
#define MAX_EXPECTED_EVENTS 10 | |
#ifndef EVENT_EXPECT_TIME | |
# define EVENT_EXPECT_TIME 5 |
NewerOlder