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 <cstdlib> | |
#include <iostream> | |
#include <locale> | |
#include <stdexcept> | |
int main() { | |
std::string line; | |
std::string input; | |
std::size_t bytes = 0; | |
std::size_t characters = 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
using System; | |
namespace Demo { | |
class Application { | |
static Application() { | |
String args = Environment.CommandLine; | |
Console.WriteLine("Called with arguments {0}", args); | |
Environment.Exit(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
var createSlideNumbering = function (skipFirstN) { | |
var num = 0; | |
$('.slides article').each(function () { | |
num += 1; | |
if (num <= skipFirstN) | |
return; | |
jQuery('<div/>', { | |
class: 'counter', | |
text: num |
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
interface Addable<T> { | |
T AddTo(T rhs); | |
} | |
T AddTwoThings(T lhs, T rhs) where T : Addable<T> { | |
return lhs.AddTo(rhs); | |
} | |
static class IntExtensions { | |
// Pseudo-syntax |
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
" Basic settings {{{ | |
set nocompatible | |
set nobackup | |
set ignorecase | |
set smartcase | |
set incsearch | |
set hlsearch | |
"set guifont=Consolas:h14 | |
" Let's have a bit of fun! |
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
#' (Re-)source parts of a file | |
#' | |
#' \code{rs} loads, parses and executes parts of a file as if entered into the R | |
#' console directly (but without implicit echoing). | |
#' | |
#' @param filename character string of the filename to read from. If missing, | |
#' use the last-read filename. | |
#' @param from first line to parse. | |
#' @param to last line to parse. | |
#' @return the value of the last evaluated expression in the source file. |
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 <cstdlib> | |
#include <fstream> | |
#include <iomanip> | |
#include <iostream> | |
#include <memory> | |
#include <sstream> | |
#include <stdexcept> | |
#include <string> | |
#include <vector> |
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
#ifndef UTIL_LANG_RANGE_HPP | |
#define UTIL_LANG_RANGE_HPP | |
#include <iterator> | |
namespace util { namespace lang { | |
namespace detail { | |
template <typename T> |
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
var result = 42.Match() | |
.With(13, x => "thirteen") | |
.WithRange(13, 42, x => "between 13 and 42") | |
.WithRange(42, 45, x => "between 42 and 45") | |
.Default(x => "not found") | |
.Get<string>(); |
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
template <typename T> | |
struct iota_iterator : std::iterator<std::random_access_iterator_tag, T> { | |
typedef std::iterator<std::random_access_iterator_tag, T> base_t; | |
typedef typename base_t::difference_type difference_type; | |
iota_iterator(T value = T()) : value(value) { } | |
iota_iterator& operator ++() { | |
++value; | |
return *this; |