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 GameOfLife where | |
| import Data.Set (Set, (\\)) | |
| import qualified Data.Set as S | |
| import Data.List (intercalate) | |
| unionMap :: (Ord a, Ord b) => (a -> Set b) -> Set a -> Set b | |
| unionMap f = S.fromList . concatMap (S.toList . f) . S.toList |
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 OverloadedStrings #-} | |
| {- To Run: | |
| Load in ghci | |
| :set -XOverloadedStrings (for convenience) | |
| Execute repl expr -} | |
| import Control.Applicative | |
| import Data.Attoparsec hiding (Result) | |
| import Data.Attoparsec.Char8 (char8, isDigit_w8, isSpace_w8) |
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
| -- | Get this amount's commodity and any commodities referenced in its price. | |
| amountCommodities :: Amount -> [Commodity] | |
| amountCommodities Amount{commodity=c,price=p} = | |
| case p of Nothing -> [c] | |
| Just (UnitPrice ma) -> c:(concatMap amountCommodities $ amounts ma) | |
| Just (TotalPrice ma) -> c:(concatMap amountCommodities $ amounts ma) |
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 <boost/spirit/home/phoenix/core.hpp> | |
| #include <boost/spirit/home/phoenix/bind.hpp> | |
| #include <boost/spirit/home/phoenix/operator.hpp> | |
| #include <boost/bind.hpp> | |
| #include "flusspferd.hpp" | |
| using namespace flusspferd; | |
| using namespace std; |
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
| buffer = require('encoding').Converter('US-ASCII', 'US-ASCII') | |
| buffer.put(magicallyMakeByteString('Hello,')) | |
| buffer.put(magicallyMakeByteString(' ')) | |
| buffer.put(magicallyMakeByteString('World!')) | |
| value = buffer.get() | |
| assert(value == magicallyMakeByteString('Hello, World!')) | |
| buffer = require('encoding').Converter('US-ASCII', 'US-ASCII') | |
| buffer.put(value) | |
| assert(buffer.get(7) == magicallyMakeByteString("Hello, ")) | |
| assert(buffer.get() == magicallyMakeByteString("World!")) |
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
| bin/ | |
| jsrepl | |
| lib/ | |
| libflusspferd.so | |
| libflusspferd-xml.so | |
| flusspferd/ | |
| prelude.js | |
| plugins/ | |
| libxml.so -> ../../libflusspferd-xml.so | |
| libcurl.so |
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
| boost::any environment::enumerate_start(int &n) { | |
| n = 0; // We dont know how many | |
| return boost::any(environ); | |
| } | |
| value environment::enumerate_next(boost::any &iter) { | |
| char **env = boost::any_cast<char**>(iter); | |
| if (*env == 0) | |
| return value(); |
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
| suite_name = 'The big test suite' | |
| test_foo = function() { | |
| expect(2); | |
| ok(1, "Check ok"); | |
| same([1,2],[3,2], "Arrays are the same"); | |
| } | |
| /* | |
| [execute in scope (new TestSuite)] |
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
| template<size_t (curl::*Method)(void *, size_t, size_t, void *)> | |
| static size_t curl::c_handle_curl(void *ptr, size_t size, size_t nmemb, void *stream) { | |
| curl *self = static_cast<curl*>(ptr); | |
| return (self->*Method)(ptr, size, nmemb, stream); | |
| } | |
| foo ( &curl::c_handle_curl<&curl::method_name> ); |
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
| Foo = { | |
| // ... | |
| } | |
| this.load = 2 |
NewerOlder