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 Main where | |
import Prelude hiding (catch) | |
import Control.Concurrent | |
import Control.Concurrent.Chan | |
import Control.Exception | |
import Network | |
import System.IO | |
import System.IO.Error | |
import Control.Monad |
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
;; Editing a class name and making it blank results in the following error: | |
;; Uncaught Error: No protocol method ITransact.-transact! defined for type string: | |
; I changed: | |
(defn handle-change [e text owner] | |
(om/transact! text (fn [_] (.. e -target -value)))) | |
; to: |
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
(def app-state {:boxes (vec (take 10 (repeat {:value 0})))}) | |
(defn box [n owner] | |
(reify | |
om/IInitState | |
(init-state [_] {:hovered false}) | |
om/IRenderState | |
(render-state [_ {:keys [hovered]}] | |
(dom/p #js {:onClick (fn [e] | |
(.preventDefault e) |
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 tumblrsearch.core | |
(:require-macros [cljs.core.async.macros :refer [go] | |
]) | |
(:require ;[clojure.browser.repl] | |
[cljs.core.async :as async :refer [put! chan <!]] | |
[om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[clojure.string :as s :refer [replace]] | |
;[figwheel.client :as fw :include-macros true] | |
; routing |
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
define([], function(){ | |
return {paths: [ | |
"M152.425 186.338c-0.266-0.402-1.148-3.341-1.568-3.054c0.016-0.016 0.038-0.025 0.06-0.032 c0.662-0.352-5.527 6.146-5.966 3.993c0 0-0.733 2.521-1.784 1.342c-1.226 1.345-1.044 0.254-0.796 1.92 c-1.073-0.566-2.385 0.324-3.943-0.175c-0.625 1.055-1.905-1.548-1.564-1.551c-0.107-0.277 1.438-0.786 0.759-0.604l0.007-0.006 c-0.069 0.021-0.129 0.06-0.177 0.116l0.117-0.078c-0.297 1.01 1.21 1.32 0.59 2.067c1.032-0.14 0.253-2.014-0.127-2.114 c0-0.366-0.732-1.862-1.635-2.159c-0.256 0.53-2.64-1.213-2.956-1.282c0.142 0.449-0.473 0.8-0.271 1.46 c0.088 0.28 0.05 0.71 0.09 0.946c-1.221-0.928-0.647 2.032-0.647 2.142c-0.021 0.81 0.97 0.56 1.51 1.02 c0.516 0.47 1.51 0.97 1.39 1.701c-0.054 0.262-1.312 1.404-1.479 1.312c-0.043-0.023-0.909-0.398-1.082-0.405 c-0.616-0.042-1.285 0.649-2.1 0.655c-0.233 0.001-1.456-0.123-1.413-0.299c-0.736 0.187-0.394 0.002-1.023 0.86 c-0.314 0.442-1.648 0.25-2.178 0.594c-1.242 0.756-0.105 0.568-1.287 0.044c-0.28-0.13-1.334 0.325-1.771 0.27 c-0.041-0.387 0.021-1.438 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title></title> | |
<style> | |
body{ | |
margin: 0 auto; | |
width: 960px; | |
} |
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
let isOdd x = case x % 2 of | |
0 -> Nothing | |
_ -> Just x | |
traverse (\ x -> isOdd x) [3,5,7,9] | |
-- Just ([3,5,7,9]) | |
sequence $ map (\ x -> isOdd x) [3,5,7,9] |
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
#lang racket/base | |
(require racket/list) | |
(define data | |
'((a b 7) | |
(a c 9) | |
(a f 14) | |
(b c 10) | |
(b d 15) |
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
#lang racket | |
(define (can-have-eulerian-path? adj-hash) | |
(define vertex-counts (map (λ (adjs) (length adjs)) (hash-values adj-hash))) | |
(or (andmap even? vertex-counts) | |
(= 2 (length (filter odd? vertex-counts))))) | |
(define (find-eulerian-path edges) | |
(define adj-hash (build-adj-hash edges)) | |
(if (not (can-have-eulerian-path? adj-hash)) #f |