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 reagent-useeffect-demo.core | |
(:require | |
[reagent.core :as r] | |
[react :as react] | |
[cljs.core.async :refer [go]] | |
[cljs.core.async.interop :refer-macros [<p!]] | |
[reagent.dom :as rdom])) | |
(defn use-pokemon [id] | |
(let [[data set-data] (react/useState {}) |
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>Keycloak SPA Demo</title> | |
<style> | |
body { |
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 com.github.hindol.euler.collections | |
(:import | |
(clojure.lang IPersistentCollection | |
IPersistentSet | |
Seqable))) | |
(deftype Bag [^clojure.lang.IPersistentMap m | |
^long n] | |
IPersistentSet | |
(get [this k] |
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
;; Adaptations of equations found in Jack Daniels - Daniels' Running Formula in clojure | |
(import (java.lang Math)) | |
(defn %VOmax | |
"Returns the percentage of VOmax a runner can sustain for the given duration" | |
[seconds] | |
(let [mins (/ seconds 60)] | |
(+ 0.8 | |
(* 0.1894393 | |
(Math/exp (* -0.012778 mins))) |
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 base64-decode | |
"Utility function over the Java 8 base64 decoder" | |
[to-decode] | |
(String. (.decode (Base64/getDecoder) ^String to-decode))) | |
(defn string->edn | |
"Parse JSON from a string returning an edn map, otherwise nil" | |
[string] | |
(when-let [edn (json/decode string true)] | |
(when (map? edn) |
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
(require '[clj-http.client :as http]) | |
(require '[clojure.core.async :as a]) | |
(require '[clojure.string :as string]) | |
(require '[clojure.java.io :as io]) | |
(import '[java.io InputStream]) | |
(def event-mask (re-pattern (str "(?s).+?\r\n\r\n"))) | |
(defn- parse-event [raw-event] | |
(->> (re-seq #"(.*): (.*)\n?" raw-event) |
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 my-assoc-in | |
[m [k & ks] v] | |
(if (empty? ks) | |
(assoc m k v) | |
(assoc m k (my-assoc-in (k m) ks v)))) |
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
#!groovy | |
# Best of Jenkinsfile | |
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins | |
node { | |
} |
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
(require '[clojure.core.async :as a]) | |
(def xform (comp (map inc) | |
(filter even?) | |
(dedupe) | |
(flatmap range) | |
(partition-all 3) | |
(partition-by #(< (apply + %) 7)) | |
(flatmap flatten) | |
(random-sample 1.0) |
NewerOlder