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
public static class ComparableExtensions | |
{ | |
public static bool IsAfter<T>(this T c1, T c2) where T:IComparable<T> | |
{ | |
return Comparer<T>.Default.Compare(c1,c2) > 0; | |
} | |
public static T Min<T>(this T c1, T c2) where T:IComparable<T> | |
{ | |
return (c1.CompareTo(c2) < 0) ? c1 : c2; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" /> | |
<xsl:template match="/plist"> | |
<xsl:element name="theme"> | |
<xsl:apply-templates /> | |
</xsl:element> | |
</xsl:template> |
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
// Inspired by https://gist.github.com/2557678 | |
// and http://dspace.mit.edu/bitstream/handle/1721.1/6935/AITR-633.pdf | |
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Threading.Tasks.Dataflow; | |
using Message = System.Object; | |
namespace Actors | |
{ | |
public interface Behavior { Behavior OnArrival(Message message); } |
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
/* | |
Below are 15 exercises. The task is to emulate the scala.Option API | |
without using Some/None subtypes, but instead using a fold (called a | |
catamorphism). | |
A couple of functions are already done (map, get) | |
to be used as an example. ScalaCheck tests are given below to | |
verify the work. The desired result is to have all tests passing. | |
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
trait PartialType[T[_, _], A] { | |
type Apply[B] = T[A, B] | |
type Flip[B] = T[B, A] | |
} | |
trait Fluffy[F[_]] { | |
def furry[A, B](f: A => B, fa: F[A]): F[B] | |
} | |
object Fluffy { |
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 <zmq.h> | |
void recv() //This name overrides something in libzmq causing things to break. | |
{ | |
//NOOP | |
} | |
int main() | |
{ | |
void* ctx = zmq_init(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
class Calc extends PackratParsers { | |
type Elem = Char | |
val vars = mutable.Map[Char,Int]() | |
def parse(input:CharSequence) = doIt(new PackratReader(new CharSequenceReader(input))) | |
val spaces: Parser[Seq[Char]] = elem("Whitespace", _.isWhitespace)* | |
val digit: Parser[Char] = elem("Digit", _.isDigit) | |
val letter: Parser[Char] = elem("Letter", _.isLetter) |
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
When discussing a particular subset of a system one can usually produce some light and useful UMLish diagrams of the topic on a whiteboard. | |
Displaying the true system model of the related components would be overwhelming and not usefull at all though. | |
I'm thinking that these ephermal aspects should be our true representation of the system implementation. | |
Instead of producing files with classes containing all related functionality ever thought of for that part of the model we should produce small snippets of design aspects relevant to the design session that created them. |