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 / worker.clj
Last active April 27, 2019 15:51
Sequential vs concurrent execution in Elixir & Clojure
(ns worker)
(defn random []
(inc (rand-int 100)))
(defn sleep [n]
(println (str "sleep(" n ") started."))
(Thread/sleep n)
(println (str "sleep(" n ") ended."))
(str "result-sleep(" n ")"))
@lagenorhynque
lagenorhynque / logback.xml
Last active April 8, 2019 02:06
Logback settings for Pedestal
<configuration scan="true" scanPeriod="1 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyyMMdd HH:mm:ss} %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
</root>
@lagenorhynque
lagenorhynque / introduction-to-intellectual-property-law.md
Last active November 11, 2022 07:03
ソフトウェア開発に関わる知的財産法入門

ソフトウェア開発に関わる知的財産法入門


(defprofile lagénorhynque
  :id           @lagenorhynque
 :reading "/laʒenɔʁɛ̃k/"
user> (require '[clojure.spec.alpha :as s]
'[clojure.spec.test.alpha :as stest])
nil
user> (s/def :contact/name string?)
:contact/name
user> (s/def :contact-info/type keyword?)
:contact-info/type
user> (s/def :contact-info/email-contact-info string?)
:contact-info/email-contact-info
user> (s/def :contact-info/postal-contact-info string?)
dev> (let [count (volatile! 0)
t1 (Thread. #(dotimes [_ 1000] (vswap! count inc)))
t2 (Thread. #(dotimes [_ 1000] (vswap! count inc)))]
(.start t1)
(.start t2)
(.join t1)
(.join t2)
@count)
1577
dev> (let [count (atom 0)
@lagenorhynque
lagenorhynque / Model.hs
Last active March 3, 2019 15:45
Simple "user" modelling examples in Clojure, Haskell & Scala.
{-# LANGUAGE NamedFieldPuns #-}
module Model where
data User = User { firstName :: !String
, lastName :: !String
}
deriving Show
fullName :: User -> String
dev> (q #:venia{:operation #:operation{:type :query
:name "MemberById"}
:variables [#:variable{:type :ID!
:name "id"}]
:queries [[:member_by_id {:id :$id}
[:member_name
[:ratings [[:game [:name
[:rating_summary [:count
:average]]
[:designers [:name
@lagenorhynque
lagenorhynque / graphql-api-in-clojure.md
Last active November 11, 2022 07:03
GraphQL API in Clojure

GraphQL API in Clojure


(defprofile lagénorhynque
  :aliases      [カマイルカ🐬]
lagenorhynchus@lagenorhynque-mbp:code$ mkdir hy-playground
lagenorhynchus@lagenorhynque-mbp:code$ cd hy-playground/
lagenorhynchus@lagenorhynque-mbp:hy-playground$ pipenv install hy
Creating a virtualenv for this project…
Pipfile: /Users/lagenorhynchus/code/hy-playground/Pipfile
Using /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7 (3.7.2) to create virtualenv…
⠇ Creating virtual environment...Already using interpreter /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7
Using real prefix '/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/lagenorhynchus/.local/share/virtualenvs/hy-playground-K-WGms8b/bin/python3.7
Also creating executable in /Users/lagenorhynchus/.local/share/virtualenvs/hy-playground-K-WGms8b/bin/python
@lagenorhynque
lagenorhynque / aqoursql_artists.png
Last active November 11, 2022 07:05
ClojureのLaciniaでGraphQL API開発してみた
aqoursql_artists.png