Skip to content

Instantly share code, notes, and snippets.

View eldritchideen's full-sized avatar

Steven Cook eldritchideen

  • Amazon Web Services
  • Australia
View GitHub Profile
extern int foo(int x, int y) {
return x * y;
}
require 'ffi'
module Foo
extend FFI::Library
ffi_lib "./libMyTest.dylib"
attach_function :foo, [:int, :int], :int
end
require 'ffi'
require './foo'
bar = Foo.foo(2, 5)
puts "The result is #{bar}"

I like Learn You a Haskell as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ 80% completion here is fine if you feel your attention waning, the next thing will address hammering in things like functors and monads via typeclasses.

https://github.com/NICTA/course/ this will hammer in the lessons in a very direct form by forcing you to confront the challenges and lessons learned by the creators and community of Haskell itself. Doing the exercises here is critical for being fluent.

Real World Haskell is available online. (Thanks bos!)

I like Learn You a Haskell as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://www.seas.upenn.edu/~cis194/lectures.html Brent Yorgey's course is the best I've found so far and replaces both Yann Esposito's HF&H and the NICTA course. This course is particularly valuable as it will not only equip you to write Haskell but also help you understand parser combinators.

Real World Haskell is available online. (Thanks bos!)

I recommend RWH as a reference (thick book). The chapters for parsing and monads are great for getting a sense for where monads are useful. Other people have said that they've liked it a lot. Perhaps a good follow-up for practical idioms after you've got the essentials of Haskell down?

/**
* gc monitoring only on jdk7 or later
*
* @author lichengwu
* @version 1.0
* @created 2013-09-14 10:44 PM
*/
public class GCMonitoring {

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

http://www.seas.upenn.edu/~cis194/lectures.html Brent Yorgey's course is the best I've found so far and replaces both Yann Esposito's HF&H and the NICTA course. This course is particularly valuable as it will not only equip you to write Haskell but also help you understand parser combinators.

Exercises for practice

@eldritchideen
eldritchideen / gist:ef9295ff6c2f6aeca24e
Last active July 20, 2017 04:46
Web scraping in Scala with Jsoup
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import scala.collection.JavaConversions._
System.setProperty("http.proxyHost", "xxx.xxx.xxx")
val doc = Jsoup.connect("http://www.smh.com.au/business/markets/52-week-highs?page=-1").get()
//doc.body()
val elems = doc.select("#content > section > table > tbody > tr > th > a")
val foo = for ( e <- elems) yield e.text
@eldritchideen
eldritchideen / project.clj
Last active April 2, 2024 16:00
Web scraping in Clojure with Jsoup
(ns scraping.core
(:gen-class)
(:import (org.jsoup Jsoup)
(org.jsoup.select Elements)
(org.jsoup.nodes Element)))
(def URL "http://www.smh.com.au/business/markets/52-week-highs?page=-1")
(defn get-page []
(.get (Jsoup/connect URL)))
@eldritchideen
eldritchideen / gist:556bf5ea2091d59923ff
Created August 15, 2014 00:03
Some Pandas Share price stuff
from pandas import *
import pandas.io.data as web
import datetime
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2014, 8, 15)
# Get daily price data
ctx = web.DataReader('ctx.ax', 'yahoo', start, end)