Skip to content

Instantly share code, notes, and snippets.

@dabd
dabd / cis194:hw2
Last active August 29, 2015 14:03
{-# OPTIONS_GHC -Wall #-}
module LogAnalysis where
import Log
-- ex 1
parseMessage :: String -> LogMessage
parseMessage line =
case words line of
("E":severity:timestamp:content) -> LogMessage (Error $ read severity) (read timestamp) (unwords content)
;; A.ahk
#Include %A_ScriptDir%\somedir\B.ahk
;; B.ahk which is in somedir\
#Include %A_ScriptDir%/../C.ahk
(defn test-println
[]
(println "hello")
(println "there!")
)
http://i.imgur.com/htdQf1J.png
myCompare :: (Ord a) => a -> a -> Ordering
a `myCompare` b
| a > b = GT
| a == b = EQ
| otherwise = LT
RoR.sim <- function(prizes, probs, BI, BR, games=NA, CI=.95, sims=1000, plots=200, warns=TRUE) {
if(sum(prizes < 0) > 0) {stop("prizes must not be below 0.")}
if(length(prizes) != length(probs)) {stop("prizes and probs must be the same length (have the same number of elements).")}
if(warns==T) {
if(sum(probs) > 1.00001 | sum(probs) < .99999) {warning("Probs might not total 1.0. Check probabilities total or set warns==FALSE")}
}
if(CI <= 0 | CI >= 1.0) {stop("CI must be between .00 and 1.00")}
LL <- (1 - CI) / 2
UL <- 1 - LL
SetFocusStarsEditBox()
{
global stars_editbox
WinGet, active_id, ID, A
ControlFocus, stars_editbox, ahk_id %active_id%
}
@dabd
dabd / gist:7809539
Last active December 30, 2015 09:29
{"Player 1:"
{"bb bet 230, sb fold"
["Js8s@0.41,Js8h@0.29,Js8d@0.31,Th8h@0.01,Td8d@0.01,Ts8s@0.03,Tc8d@0.4,Th8d@0.6,Td8h@0.61,Tc8h@0.41,Ts8h@0.96,Ts8d@0.96,Td8s@0.56,Th8s@0.57,Tc8s@0.37,Th7h,Td7d,Tc7c,9s8s@0.06,9s8h@0.94,9h8s@0.84,9s8d@0.95,9c8s@0.74,9d8s@0.85,9c8h@0.21,9d8h@0.33,9c8d@0.23,9h8d@0.34,9h6h,9d6d,9c6c,6h5h,6d5d,6c5c"
{"One Pair"
["Js8s"
"Js8h"
"Js8d"
"Th8h"
"Td8d"
"Ts8s"
(defn best
[f coll]
(if (seq coll)
(reduce #(if (f %1 %2) %1 %2) coll)
nil))
(defn most
[f coll]
(if (seq coll)
(reduce (fn [[wins wins-score] x]
@dabd
dabd / gist:7666778
Last active December 29, 2015 11:49
(ns testzip.core
(:require [clojure.zip :as z]))
(defn make-node [n children]
(cons (first n) children))
(defn tree-zipper [v]
(z/zipper vector? next make-node v))