This file contains hidden or 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 bench-btset [] | |
(doseq [distinct [:distinct :duplicates] | |
size [20000] | |
[tn target] [["sorted-set" (sorted-set)] | |
["btset" (btset/btset)] | |
["vector" []]] | |
:let [range (if (= :distinct distinct) | |
(shuffle (range size)) | |
(repeatedly size #(rand-int size))) | |
shuffled-range (shuffle range) |
This file contains hidden or 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 [a 1, a 2, a 3] | |
(and (= a 1) (= a 2) (= a 3))) |
This file contains hidden or 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
;; I have this | |
(def routes ["/" [["" :ui/index] | |
["api/query" :api/query] | |
["api/data-init" :api/data-init]]]) | |
;; And I want to make api/data-init only accesible through POST | |
;; I tried | |
(def routes ["/" [["" :ui/index] |
This file contains hidden or 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 datomicdemo.core | |
(:require | |
[clojure.edn] | |
[clojure.string :as str] | |
[datomic.api :as d])) | |
(def url "datomic:free://localhost:4334/datomicdemo") | |
(d/create-database url) |
This file contains hidden or 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
package com.example.onair | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.compose.* | |
import androidx.ui.core.Text | |
import androidx.ui.core.dp | |
import androidx.ui.core.setContent | |
import androidx.ui.foundation.Clickable | |
import androidx.ui.foundation.ColoredRect |
This file contains hidden or 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 end? [[x1 x2 x3 x4 x5 x6 x7 x8 x9]] | |
(or | |
(and (some? x1) (= x1 x2 x3)) | |
(and (some? x4) (= x4 x5 x6)) | |
(and (some? x7) (= x7 x8 x9)) | |
(and (some? x1) (= x1 x4 x7)) | |
(and (some? x2) (= x2 x5 x8)) | |
(and (some? x3) (= x3 x6 x9)) | |
(and (some? x1) (= x1 x5 x9)) | |
(and (some? x3) (= x3 x5 x7)) |
This file contains hidden or 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
package fitnesse.html; | |
import fitnesse.responders.run.SuiteResponder; | |
import fitnesse.wiki.*; | |
public class SetupTeardownIncluder { | |
public static String render(PageData pageData, boolean isSuite) throws Exception { | |
StringBuilder sb = new StringBuilder(); | |
WikiPage testPage = pageData.getWikiPage(); | |
if (pageData.hasAttribute("Test")) { |
This file contains hidden or 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
- Types of reuse | |
- Layer | |
- Completely abstracts underlying problem. Your code calls layer | |
- Assume singleton, can conflict with another layer | |
- Engine | |
- Orchestrates whole app Engine calls you | |
- Component | |
- You call component, but component might call you back | |
- Most benefits, hardest to design | |
- Optimization axes |
This file contains hidden or 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
top10Salaries :: FilePath -> IO () | |
top10Salaries path = do | |
Just (h, t) <- uncons . T.lines <$> T.readFile path | |
let | |
split = T.splitOn "," | |
Just ind = elemIndex "Salary" $ split h | |
top10 :: [Int] = t | |
& map (\s -> read $ T.unpack $ split s !! ind) | |
& sortBy (flip compare) | |
& take 10 |