This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert'); | |
/* | |
* 1 + 2 * 3 --> 7 | |
* Plus(1, Mult(2, 3)) | |
*/ | |
/* | |
* There are three kinds of arithmetic expressions: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns asink.core | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [cljs.core.async :refer [<! timeout]] | |
[cljs.nodejs :as n])) | |
(n/enable-util-print!) | |
(defn spin [] | |
(go (println "spinning...") | |
(<! (timeout 1000)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns asink.core | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [cljs.core.async :refer [<! timeout]] | |
[cljs.nodejs :as n])) | |
(n/enable-util-print!) | |
(declare ping) | |
(declare pong) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JoinList where | |
import Prelude hiding (drop, take) | |
import Data.Monoid | |
newtype Size = Size Int | |
class Sized b where | |
size :: b -> Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns streamus.core | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [cljs.core.async :refer [<! >! chan timeout]] | |
[om.core :as om :include-macros true] | |
[om-tools.core :refer-macros [defcomponent]] | |
[om-tools.dom :as dom :include-macros true])) | |
(defn ^:export onYouTubePlayerAPIReady [] | |
(. js/console (log "we're ready to youtube!"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RandomStuff where | |
import Data.List | |
import Prelude hiding (flip) | |
import System.Random | |
type Organism = [Int] | |
flip :: [Int] -> Int -> [Int] | |
flip [] i = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import xml.etree.ElementTree as ET | |
import pdb | |
data = requests.get('http://www.treasury.gov/resource-center/data-chart-center/interest-rates/pages/XmlView.aspx?data=yield') | |
xml = ET.fromstring(data.content) | |
entries = xml.findall('.//{http://www.w3.org/2005/Atom}entry') | |
def getTagName(element): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module B where | |
import Prelude hiding (take) | |
import Control.Applicative ((<|>), (<*), (*>), many, liftA2) | |
import Control.Arrow ((>>>)) | |
import Data.Attoparsec.ByteString (Parser, maybeResult, parse, take) | |
import Data.Attoparsec.ByteString.Char8 (char, decimal) | |
import Data.ByteString (ByteString) | |
data Decoding = S ByteString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
import Control.Concurrent | |
import Control.Concurrent.STM | |
import Control.Exception | |
import Control.Monad | |
import Network (listenOn, PortID(PortNumber), withSocketsDo) | |
import Network.Socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Concurrent | |
import Control.Exception | |
-- ಠ_ಠ | |
import System.IO.Unsafe | |
ioLock :: MVar () | |
ioLock = unsafePerformIO $ do | |
lock <- newEmptyMVar | |
putMVar lock () |
OlderNewer