View gcd.py
1 2 3 4 5 6 7 8 9
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
 
# http://stackoverflow.com/questions/11175131/code-for-greatest-common-divisor-in-python
def gcd(x, y):
while y != 0:
(x, y) = (y, x % y)
return x
View limacon-1.md

Wikipedia: Let P be a point and C be a circle whose center is not P. Then the envelope of those circles whose center lies on C and that pass through P is a limaçon.

View subway.py
1 2 3 4 5 6 7 8 9 10
import requests
 
key = ''
r = requests.get('http://datamine.mta.info/mta_esi.php?key=%s&feed_id=1'%(key))
 
# http://datamine.mta.info/sites/all/files/pdfs/nyct-subway.proto.txt
# https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto
# https://github.com/google/protobuf
 
import gtfs_realtime_pb2, nyct_subway_pb2
View 2048.html
1 2 3 4 5 6 7 8 9
<html>
 
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
 
<body>
 
<svg id="board" width=500 height=500></svg>
View notes.hs
1 2 3 4 5 6 7 8 9 10
-- variant of tutorial
-- type "./notes" in terminal
 
{-# LANGUAGE OverloadedStrings #-}
 
import Control.Monad (forM_)
import Text.Blaze.Html5
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
View command.sh
1 2 3 4 5
wget -O http://jaspervdj.be/blaze | blaze-from-html -v html4-transitional
 
#OR
 
curl -S http://jaspervdj.be/blaze | blaze-from-html -v html4-transitional
View 1-helloworld.hs
1 2 3 4 5 6 7 8 9 10
-- http://hackage.haskell.org/package/pipes-text-0.0.0.12/docs/Pipes-Text-IO.html
-- http://hackage.haskell.org/package/pipes
-- http://hackage.haskell.org/package/pipes-text
 
import Pipes
import qualified Pipes.Text as Text
import qualified Pipes.Text.IO as Text
import System.IO
 
-- http://stackoverflow.com/questions/19521246/what-does-mean-do-in-haskell
View mult.elm
1 2 3
sum [2,3,4]
 
product [2,3,4]
View items.elm
1 2 3 4 5 6 7 8 9 10
f x y = [x] ++ y
--<function> : a -> [a] -> [a]
g y = (\x -> f x y)
--<function> : [a] -> a -> [a]
items = [1,2,3]
--[1,2,3] : [number]
 
g items
--<function> : number -> [number]
g items 5
Something went wrong with that request. Please try again.