Skip to content

Instantly share code, notes, and snippets.

View jpfuentes2's full-sized avatar

Jacques Fuentes jpfuentes2

  • Chime
  • Richmond, VA
View GitHub Profile
{-# LANGUAGE DeriveDataTypeable #-}
import Control.Monad.Random
import System.Random.Shuffle
import Data.Typeable
import Data.Data
import Control.Applicative
data Suit = Hearts | Clubs | Diamonds | Spades
deriving (Eq, Data, Typeable)
package main
import (
"fmt"
"net"
"os"
)
const (
CONN_HOST = "localhost"
@jpfuentes2
jpfuentes2 / go.md
Last active August 29, 2015 14:11
Introductory resources to Golang
scala> val x: Option[String] = Option[String](null)
x: Option[String] = None
scala> x.isDefined
res0: Boolean = false
scala> x.getOrElse("foo")
res1: String = foo
scala> x.map(_.length)
github.com/onsi/ginkgo/ginkgo
github.com/onsi/ginkgo
import scalaz._
import Scalaz._
trait Read[F] { self =>
def read(f: String): F
}
object Read {
@inline def apply[F](implicit F: Read[F]): Read[F] = F
}
import List
import Set
import Html exposing (text)
type Suit = Hearts | Spades | Clubs | Diamonds
type Value = Two | Three | Four | Five | Six | Seven | Eight | Nine |
Ten | Jack | Queen | King | Ace
type alias Card = (Suit, Value)
case class Person(name: String)
case class Alias(name: String)
case class PersonWithAliases(p: Person, aliases: List[Alias])
/*
do some merging magic of Person with Alias to produce:
<?php
class DateTime extends \DateTime
{
private static $DATE_NAMES = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
private static $FORMATS = array('ymd' => 'Y-m-d', 'jenark' => 'm/d/y', 'mysql' => 'Y-m-d');
private static $DEFAULT_FORMAT = 'ymd';
public function __call($method, $args)
{
if (substr($method, 0, 2) === "is" && in_array(substr($method, 2), self::$DATE_NAMES))