Skip to content

Instantly share code, notes, and snippets.

@kcris
kcris / monad03.cpp
Created November 14, 2012 10:07
monad in c++ 03
//
//http://c2.com/cgi/wiki?CeePlusPlusMonadsExample
//
//see also: http://c2.com/cgi/wiki?OnMonads
//
#include <iostream>
template<typename A_>
struct monad
@kcris
kcris / monad11.cpp
Last active October 12, 2015 18:48 — forked from splinterofchaos/monad.cpp
monad in c++ 11 (fork)
#include <memory>
#include <iostream>
#include <utility>
#include <algorithm>
#include <iterator>
struct sequence_tag {};
struct pointer_tag {};
template< class X >
//
//http://bytes.com/topic/c/answers/216333-binary-constant-macros
//
/* Binary constant generator macro
By Tom Torfs - donated to the public domain
*/
/* All macro's evaluate to compile-time constants */
@kcris
kcris / treepath.hpp
Last active December 17, 2015 08:18
#ifndef TREEPATH_H
#define TREEPATH_H
#include <QtCore/QLinkedList>
#include <iostream>
/*
* inspired by:
*
@kcris
kcris / polymorphicValues.cpp
Last active December 31, 2015 17:29
Polymorphism involving objects with value semantics (C++)
/*
(c) 2013 +++ Filip Stoklas, aka FipS, http://www.4FipS.com +++
THIS CODE IS FREE - LICENSED UNDER THE MIT LICENSE
ARTICLE URL: http://forums.4fips.com/viewtopic.php?f=3&t=1194
*/
#include <iostream>
#include <vector>
#include <memory>
@kcris
kcris / listMonad11.cpp
Created March 4, 2014 12:21
list monad in c++ 11
//https://news.ycombinator.com/item?id=7319417
#include <iostream>
#include <list>
#include <functional>
using namespace std;
// fmap :: (a -> b) -> f a -> f b
@kcris
kcris / cpp11test.cpp
Created November 27, 2014 10:28
first tests for c++ 11 and c++14 support - using visual studio 2013 professional
//
// c++ 11
//
// http://bfilipek.hubpages.com/hub/What-you-should-know-about-C11
// http://bfilipek.hubpages.com/hub/What-you-should-know-about-C11-Part-II
// http://bfilipek.hubpages.com/hub/What-you-should-know-about-C11-Part-III
//
#include <string>
#include <iostream>
#include <vector>
@kcris
kcris / freenom.com.ddns.sh
Created April 11, 2017 18:39 — forked from a-c-t-i-n-i-u-m/freenom.com.ddns.sh
Dynamic DNS support shell script for freenom.com
#!/bin/bash
# settings
# Login information of freenom.com
freenom_email="main@address"
freenom_passwd="pswd"
# Open DNS management page in your browser.
# URL vs settings:
# https://my.freenom.com/clientarea.php?managedns={freenom_domain_name}&domainid={freenom_domain_id}
freenom_domain_name="domain.name"