Skip to content

Instantly share code, notes, and snippets.

View lagenorhynque's full-sized avatar
🐬
architecting & managing

Kent OHASHI lagenorhynque

🐬
architecting & managing
View GitHub Profile
@lagenorhynque
lagenorhynque / github_graphql_api_client.clj
Last active March 14, 2025 15:08
A minimal GitHub GraphQL API client implemented as a babashka (Clojure) script
#!/usr/bin/env bb
(ns github-graphql-api-client
(:require
[babashka.curl :as curl]
[cheshire.core :as cheshire]
[clojure.pprint :refer [pprint]]))
(def auth-token (System/getenv "AUTH_TOKEN"))
(def graphql-query
@lagenorhynque
lagenorhynque / start-presentation.sh
Last active November 11, 2022 06:59
労働法の世界
#!/usr/bin/env bash
# npm install -g reveal-md
reveal-md the-world-of-labour-law.md --theme night --highlight-theme monokai-sublime -w "$@"
@lagenorhynque
lagenorhynque / simple-dsls-in-clojure.md
Last active November 11, 2022 06:59
Clojureで作る"simple"なDSL

Clojureで作る"simple"なDSL


(defprofile lagénorhynque
  :id           @lagenorhynque
 :reading "/laʒenɔʁɛ̃k/"
@lagenorhynque
lagenorhynque / department_adjacency_list_all.png
Last active November 11, 2022 07:00
RDBでのツリー表現入門
department_adjacency_list_all.png

GraphQL入門


(defprofile lagénorhynque
  :id           @lagenorhynque
 :reading "/laʒenɔʁɛ̃k/"
@lagenorhynque
lagenorhynque / higher_order_function_spec.clj
Last active April 18, 2020 11:19
Speccing a higher-order function with clojure.spec (+ test.check)
dev> (require '[clojure.spec.alpha :as s]
'[clojure.spec.test.alpha :as stest])
nil
dev> (defn twice [f x]
(f (f x)))
#'dev/twice
dev> (s/fdef twice
:args (s/cat :f (s/fspec :args (s/tuple integer?)
:ret integer?)
:x integer?)
@lagenorhynque
lagenorhynque / fizzbuzz_list.hs
Last active April 13, 2020 06:13
FizzBuzz as infinite sequence in Clojure/Haskell
> fizzBuzz = map (\(f, b, n) -> maybe "" id f ++ maybe "" id b ++ (if null f && null b then show n else "")) $ zip3 (cycle [Nothing, Nothing, Just "Fizz"]) (cycle [Nothing, Nothing, Nothing, Nothing, Just "Buzz"]) [1..]
fizzBuzz :: [[Char]]
[Prelude]
> take 30 fizzBuzz
["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14","FizzBuzz","16","17","Fizz","19","Buzz","Fizz","22","23","Fizz","Buzz","26","Fizz","28","29","FizzBuzz"]
it :: [[Char]]
[Prelude]
> import Data.Maybe
[Prelude Data.Maybe]
> fizzBuzz' = map (\(f, b, n) -> fromMaybe "" f ++ fromMaybe "" b ++ (if null f && null b then show n else "")) $ zip3 (cycle [Nothing, Nothing, Just "Fizz"]) (cycle [Nothing, Nothing, Nothing, Nothing, Just "Buzz"]) [1..]
@lagenorhynque
lagenorhynque / everyday-life-with-clojure-spec.md
Last active November 11, 2022 07:00
Everyday Life with clojure.spec

Everyday Life

with clojure.spec


(defprofile lagénorhynque
@lagenorhynque
lagenorhynque / fun-of-multi-language-learning.md
Last active November 11, 2022 07:01
たのしい多言語学習: 実例とともに言語学の基礎知識を学ぼう

たのしい多言語学習

実例とともに言語学の基礎知識を学ぼう


(defprofile lagénorhynque
@lagenorhynque
lagenorhynque / case_class.scala
Created March 19, 2020 16:54
Clojure's records, Scala's case classes & Java's records
$ scala
Welcome to Scala 2.13.1 (OpenJDK 64-Bit Server VM, Java 14).
Type in expressions for evaluation. Or try :help.
scala> case class Point(x: Int, y: Int) {
| def +(other: Point): Point = Point(this.x + other.x, this.y + other.y)
| }
defined class Point
scala> val p1 = Point(1, 2)