Skip to content

Instantly share code, notes, and snippets.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tristique est dolor. Sed varius tortor quis bibendum facilisis. Suspendisse ultricies eros lobortis urna vestibulum tempor in tincidunt est. Maecenas suscipit consectetur augue, sed tincidunt lectus sagittis ut. Etiam fringilla, urna ac ullamcorper ultrices, quam mi tincidunt tortor, et mattis erat neque vestibulum risus. Curabitur fringilla, eros non imperdiet ultrices, ligula odio pulvinar enim, in viverra turpis eros quis dolor. Cras pretium blandit enim. Nulla lacus risus, lobortis sit amet interdum a, vulputate eu nulla. Maecenas commodo diam sodales sapien pharetra vestibulum. Sed lorem turpis, vehicula eu lorem rhoncus, consequat eleifend tellus. Quisque adipiscing arcu a lacus semper, eu aliquet nisi ultricies. Aenean laoreet massa volutpat, posuere felis non, faucibus risus. Quisque nisi enim, convallis vel felis et, dapibus ultricies eros. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Cura
@ClaireNeveu
ClaireNeveu / benchmark.py
Last active August 29, 2015 14:04
Benchmark
from __future__ import absolute_import, division, print_function
import requests
import csv
import time
import argparse
## Installation Instructions
#1 Install Python (2 or 3)
#2 Install Pip
#3 Pip Install Requests
@ClaireNeveu
ClaireNeveu / build.sbt
Last active August 29, 2015 14:04
Scala 2.10.2 Bug
scalaVersion := "2.10.2"
@ClaireNeveu
ClaireNeveu / duration.hs
Created August 14, 2014 13:18
Duration
{-# LANGUAGE FlexibleInstances, PostfixOperators, GeneralizedNewtypeDeriving #-}
module Data.Duration
( Duration
, seconds
, second
, minutes
, minute
, hours
, hour
@ClaireNeveu
ClaireNeveu / getBlogFollows
Created August 21, 2014 17:47
get Blog follows
#!/usr/bin/python
from sys import argv
import urllib2
import json
from time import sleep
blogHost = argv[1]
def run(host):
@ClaireNeveu
ClaireNeveu / main.scala
Created August 27, 2014 12:23
Type Class Resolution Example
package com.main
import com.model.Model
import com.typeclass._
object Main extends App {
import com.alternate._
val bar = Model(1, 2)
println("The result is: " + foo(bar))
@ClaireNeveu
ClaireNeveu / CanSerialize.scala
Last active August 29, 2015 14:05
Mixing and Matching Type Class Instances for Nested Objects
package com.serialization
trait CanSerialize[A] {
def serialize0(a: A): String
}
package object compact {
import com.model._
val compactBlogSerializer = new CanSerialize[Blog] {
@ClaireNeveu
ClaireNeveu / Formatting.md
Last active August 29, 2015 14:06
Personal Scala Code Style

The standard indention level is 3 and indentation should be done with spaces.

if (true) {
   val foo = ...
   ...
}

Brackets should only be used when a block is required. If the block can be replaced by a single expression, the single expression is preferred.

@ClaireNeveu
ClaireNeveu / Version.scala
Last active August 29, 2015 14:07
Version.scala
package versioning
case class Version(n : Int)
object Version {
class CurriedVersion private[versioning] (v : Version, lb : Int) {
def and(ub : Int) = v.n >= lb && v.n < ub
}
class CurriedVersion0 private[versioning] (v : Version, lb : Int) {
def <(ub : Int) : Boolean = v.n >= lb && v.n < ub
@ClaireNeveu
ClaireNeveu / style.md
Last active August 29, 2015 14:07
Haskell Style Guide

ADT fields should be strict in the general case. This usually reduces memory usage without impacting CPU usage. There are exceptions.

The standard indentation level is 4; indentation should always be done with spaces.

The following ADT definitions are acceptable.

data Foo 
  = Bar Int Int Int
  | Baz String String String
 | Qux Int String