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
; | |
; Still learning Clojure... | |
; | |
; Walk a directory or a series of directories and return a map of their files paths | |
; | |
; I initially started with the directory walk example here: | |
; | |
; http://rosettacode.org/wiki/Walk_a_directory/Recursively#Clojure | |
; | |
(defn walk [dirpaths pattern] |
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
;; | |
;; Part of some learning exercises I'm doing. This returns a map of filenames for a series of file paths passed in | |
;; | |
(defn get-filenames-from-paths [& paths] | |
(map #(-> % | |
(.getFileName) | |
(.toString)) | |
(map #(java.nio.file.Paths/get (.toURI (java.io.File. %))) paths))) |
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
(defn actions [array-of-funcs] | |
(doseq [func array-of-funcs] (func))) |
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
; Playing here, trying to figure out how to work with vectors of maps, my brain synapses are connecting but | |
; this code doesn't totally reflect the connections made. This will be rectified within 24 hours! HAHA! | |
;(def buffers (atom [])) | |
;(swap! buffers conj {:file-name "one.txt" :file-text "first file"} | |
; {:file-name "two.txt" :file-text "second file"} | |
; {:file-name "three.txt" :file-text "third file"} | |
; {:file-name "four.txt" :file-text "fourth file"}) |
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
; This does not work, boo! Don't know how to tell Clojure that IsReusable is a property | |
(System.Reflection.Assembly/LoadWithPartialName "System.Web") | |
(defn foo-handler [] | |
(reify System.Web.IHttpHandler | |
(IsReusable [] false) | |
(ProcessRequest [context] ()))) |
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 data (atom [])) | |
;(def data1 [{:abc "123"}{:bcd "234"}]) | |
;swap! data conj {:foo "bar"}) | |
;(swap! data into data1) | |
(def more-data ["foo" "bar" "hello" "world"]) | |
(swap! data into (map #(conj {} {:name %}) more-data)) | |
(swap! data conj {:hello "1234"}) |
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
(defproject your-project "0.0.1-SNAPSHOT" | |
:description "Describe your app here" | |
:url "http://somewhere.com" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[org.clojure/clojurescript "0.0-2138"]] | |
:plugins [[lein-cljsbuild "1.0.1"]] | |
:cljsbuild | |
{:builds |
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 main.core) | |
(def app (js/require "app")) | |
(def browser-window (js/require "browser-window")) | |
(def crash-reporter (js/require "crash-reporter")) | |
(def main-window (atom nil)) | |
(defn init-browser [] | |
(reset! main-window (browser-window. (clj->js {:width 800 :height 600}))) |
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
type HelloWorldHandler() = | |
interface IHttpHandler with | |
member this.IsReusable | |
with get() = false | |
member this.ProcessRequest(context:HttpContext) = | |
context.Response.ContentType <- "text/html" | |
context.Response.Write("<b>I love F# OMG!</b>") |