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
var Blotre = require('blotre'); | |
var rp = require('request-promise'); | |
var fs = require('fs'); | |
var cron = require('cron'); | |
var weatherSpectrum = new (require('colour-me-life'))(); | |
weatherSpectrum.setSpectrum('blue', 'green', 'red'); | |
weatherSpectrum.setNumberRange(0.0, 1.0); | |
var ZIP = "92328"; |
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 <utility> | |
/** | |
Ordered collection of bits. | |
*/ | |
template <bool... values> | |
using bitset = std::integer_sequence<bool, values...>; | |
/** |
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
/** | |
* Conway's game of life implemented in C++ templates at compile time using Comonads. | |
* | |
* Logic based on: http://blog.emillon.org/posts/2012-10-18-comonadic-life.html | |
*/ | |
#include <iostream> | |
/// Identity functor | |
template <typename X> | |
struct id { |
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
/// Identity functor | |
template <typename X> | |
struct id { | |
using type = X; | |
}; | |
/// Create a meta functor that returns `X` when invoked with any argument. | |
template <typename X> | |
struct constant { | |
template <typename> |
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 <utility> | |
using iochar = char; | |
using memval = unsigned char; | |
/* BF Memory Cell */ | |
template <memval val = 0> | |
struct Cell { | |
enum { value = val }; | |
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
// Example only shows expansion logic, not perfect forwarding | |
template<class F, class T, size_t... I> | |
auto unpack(F f, T t, std::index_sequence<I...>) { | |
return f(std::get<I>(t)...); | |
} | |
template<class F, class T> | |
auto tuple_eval(F f, T arg) { | |
return unpack(f, args, std::make_index_sequence<std::tuple_size<T>::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
with | |
import 'akh::base' {liftM2}, | |
import 'akh::dcont' {runDCont of shift reset} | |
in { | |
var list = liftM2 @ \x y -> [x, y]; | |
runDCont( | |
reset \ p -> | |
liftM2((+), | |
shift @ p \k -> |
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
var words = function(count, wl) { | |
var out = []; | |
for (var i = 0; i < count; ++i) { | |
var len = Math.ceil(Math.random() * wl); | |
var w = ''; | |
while (len--) | |
w += String.fromCharCode('a'.charCodeAt(0) + Math.floor(Math.random() * 26)) | |
out.push(w); | |
} | |
return out; |
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/sh | |
KHEPRI="khepri" | |
OPTIONS="" | |
SRC=lib | |
DEST=dist | |
DEST_NODE=dist_node | |
function _compile { |
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
var idToken = letter; | |
var divToken = character('/'); | |
var regularExpressionToken = binds( | |
enumeration( | |
between(character('/'), character('/'), | |
eager <| many(letter)), | |
optional('', letter)), | |
\body, flag -> | |
always('/' + body +'/' + flag + ')')); |