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 <stdio.h> | |
#include <stdlib.h> | |
typedef void (*void_func)(void); | |
typedef struct tagaClass | |
{ | |
void_func *vptr; | |
int a; | |
} aClass; |
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 cini = require('cinister'); | |
var make_message = function (name, type) { | |
type = type.toUpperCase(); | |
var html = name + ' is ' + type.toUpperCase(); | |
if (type === 'GOOD') { | |
return '<h1>' + html + '</h1>'; | |
} | |
else if (type === 'BAD') { | |
return '<h2>' + html + '</h2>'; |
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 cini = require('cinister'); | |
var make_message = function (name, type) { | |
type = type.toUpperCase(); | |
var html = name + ' is ' + type.toUpperCase(); | |
if (type === 'GOOD') { | |
return '<h1>' + html + '</h1>'; | |
} | |
else if (type === 'BAD') { | |
return '<h2>' + html + '</h2>'; |
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
// | |
// main.cpp | |
// printf | |
// A crude but safe printf in C++11. | |
// Created by Sourav Datta on 17/05/13. | |
// Copyright (c) 2013 Sourav Datta. All rights reserved. | |
// | |
#include <iostream> | |
#include <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
object ProdDiscount { | |
// The state monad | |
class StateMonad[T](val candidate: T) { | |
// The combinator method, << operator overloaded! | |
def <<(fn: (T) => StateMonad[T]): StateMonad[T] = fn(this.candidate) | |
} | |
object StateMonad { | |
def apply[T](candidate: T): StateMonad[T] = new StateMonad[T](candidate) |
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 <iostream> | |
#include <utility> | |
template <bool C, class T> | |
struct enable_when | |
{ | |
}; | |
template <class T> | |
struct enable_when<true, 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
#include <iostream> | |
#include <type_traits> | |
#include <utility> | |
template <class T, class ... ArgT> | |
struct has_arg_ctor | |
{ | |
private: | |
using yes = char[2]; | |
using no = char[1]; |
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
(defun ask (&optional (what "name")) | |
(let ((data nil)) | |
(progn | |
(format t ">>> ~A~%" (progn (format t "What is your ~A? " what) | |
(setf data (read-line)))) | |
data))) | |
(defun ask-n (n) | |
(let ((data nil)) |
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
(defn find-while | |
[things thing in-things] | |
(cond | |
(match-star-var thing) [in-things things] | |
(match-var thing) [(concat in-things (butlast things)) [(last things)]] | |
(not (seq things)) (if (nil? thing) | |
[in-things []] | |
:fail) | |
(= (first things) thing) [in-things things] | |
:else (recur (rest things) thing (conj in-things (first things))))) |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
int value(char c) | |
{ | |
switch (c) { | |
case 'A': |
OlderNewer