Skip to content

Instantly share code, notes, and snippets.

@izahn
izahn / helm_config.el
Created May 20, 2016 19:48
Helm config
;;; Completion hints for files and buffers buffers
(require 'helm-config)
(helm-mode 1)
;;rebind tab to do persistent action
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
;; make TAB works in terminal
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
;list actions using C-z
(define-key helm-map (kbd "C-z") 'helm-select-action)
#I @"..\packages\"
#r @"FSharp.Data\lib\net40\FSharp.Data.dll"
#load @"FSPlot\FsPlotBootstrap.fsx"
#r @"Deedle\lib\net40\Deedle.dll"
do fsi.AddPrinter(fun (printer:Deedle.Internal.IFsiFormattable) -> "\n" + (printer.Format()))
open Deedle
open FSharp.Data
open System
type Twitter = CsvProvider< @"C:\Users\Isaac\Downloads\fsharp_2013-2014.csv">
Date Open High Low Close Volume Adj Close
2013-11-07 37.96 38.01 37.43 37.50 60437400 37.50
2013-11-06 37.24 38.22 37.06 38.18 88615100 38.18
2013-11-05 35.79 36.71 35.77 36.64 51646300 36.64
2013-11-04 35.59 35.98 35.55 35.94 28060700 35.94
2013-11-01 35.67 35.69 35.39 35.53 40264600 35.53
2013-10-31 35.66 35.69 35.34 35.41 41682300 35.41
2013-10-30 35.53 35.79 35.43 35.54 36997700 35.54
2013-10-29 35.63 35.72 35.26 35.52 31702200 35.52
2013-10-28 35.61 35.73 35.27 35.57 38383600 35.57
@isaacabraham
isaacabraham / accord.fs
Last active October 4, 2016 01:25
accord on f#?
open Accord.MachineLearning.FSharp
open Deedle
let data = [ ("D1", "Sunny", "Hot", "High", "Weak", "No" )
("D2", "Sunny", "Hot", "High", "Strong", "No" )
("D3", "Overcast", "Hot", "High", "Weak", "Yes")
("D4", "Rain", "Mild", "High", "Weak", "Yes")
("D5", "Rain", "Cool", "Normal", "Weak", "Yes")
("D6", "Rain", "Cool", "Normal", "Strong", "No" )
("D7", "Overcast", "Cool", "Normal", "Strong", "Yes")
@jackfarrington
jackfarrington / scala-by-example-exercise-6.0.3.scala
Created August 15, 2015 04:58
Scala By Example exercise 6.0.3
/*
* The trait Nat is provided by the text.
*/
trait Nat {
def isZero: Boolean
def predecessor: Nat
def successor: Nat
def +(that: Nat): Nat
def -(that: Nat): Nat
@mslinn
mslinn / PaypalTransaction.scala
Last active October 25, 2016 01:31
Attempt to persist entities with >22 fields via Slick. Cannot find documentation on how nested tuples are supposed to work; tried creating two helper classes (CustomerAddress and PaymentDetail). Compiler error is: scala: overloaded method value <> with alternatives: [R(in method <>)(in method <>)(in method <>)(in method <>)(in method <>)(in meth…
package com.micronautics.paypal
import java.util.{ List, Map }
import collection.JavaConversions._
import collection.immutable.HashMap
import controllers.Email
import org.joda.time.DateTime
import slick.driver.MySQLDriver.simple._
import java.util
@krishnanraman
krishnanraman / gist:4759672
Last active October 25, 2016 01:32
Tony Morris class
// And by the way, please feel free to contribute, correct errors, etc!
trait Functor[F[_]] {
def fmap[A, B](f: A => B): F[A] => F[B]
}
object Functor {
val ListFunctor: Functor[List] =
new Functor[List] {
def fmap[A, B](f: A => B) =
@derekmorr
derekmorr / gist:dd2ae28fdd5aced2d727
Created July 9, 2015 03:34
Structural typing in Scala
case class Circle(radius: Double) {
def area = radius * radius * Math.PI
}
case class Rectangle(side: Double) {
def area = side * side
}
case class Triangle(base: Double, height: Double) {
def area = 0.5d * base * height
@jroesch
jroesch / GADTs.scala
Created May 25, 2013 21:54
Scala GADTs
/* http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#gadt
Generalized Algebraic Datatypes in Scala */
trait Term[A]
case class Lit(x: Int) extends Term[Int]
case class Succ(x: Term[Int]) extends Term[Int]
case class IsZero(x: Term[Int]) extends Term[Boolean]
case class If[A](guard: Term[Boolean], t: Term[A], y: Term[A]) extends Term[A]
case class Pair[A, B](x: Term[A], y: Term[B]) extends Term[(A,B)]
@denen99
denen99 / gist:6765084
Created September 30, 2013 15:01
Coursera week 2 scala tests
package funsets
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
/**
* This class is a test suite for the methods in object FunSets. To run
* the test suite, you can either: