記述能力の高い Clojure.
よくあるプログラミングの演習問題を Clojure で解いてみます.
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 intro-seq.core | |
(:use [clojure.contrib seq])) | |
;; Clojure初心者向けに覚えておくと便利なシーケンス操作関数の使用例を列挙する | |
;; 1.2でclojure.coreに移動し、廃止予定(DEPRECATED.)になってるのもある | |
;; 全部で18個(DEPRECATEDは8個) | |
;; 使用頻度高そう系(4個) |
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 foo | |
(:import (java.util Properties) | |
javax.mail.internet.MimeMessage | |
(javax.mail.internet MimeMessage InternetAddress) | |
(javax.mail Session Transport Authenticator | |
PasswordAuthentication Message$RecipientType))) | |
(defn send-gmail [{:keys [from to subject text user password]}] | |
(let [auth (proxy [Authenticator] [] | |
(getPasswordAuthentication [] |
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
;;; Copyright (c) 2013 Yoshinori Kohyama. Distributed under the BSD 3-Clause License. | |
(ns puyo | |
(:require [clojure.test :refer (with-test run-tests are)] | |
[clojure.set :refer (union)] | |
[clojure.string :as string])) | |
(with-test | |
(defn- fall-one [b s] | |
(->> (reverse b) | |
(apply map vector) |
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 my-project.http-server | |
(:require [compojure.core :as compojure] | |
[com.stuartsierra.component :as component] | |
[my-project.my-resource :as my-resource] | |
[ring.adapter.jetty :as jetty])) | |
(compojure/defroutes app | |
my-resource/handler) | |
(defrecord HTTPServer [port server] |
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
;; put this into profiles.clj in ~/.lein folder | |
{:user {:jvm-opts ^:replace ["-Xmx6G" | |
"-XX:-OmitStackTraceInFastThrow"] | |
:repl-options {:timeout 180000} | |
:plugins [[cider/cider-nrepl "0.49.0"] | |
[refactor-nrepl "3.10.0"] | |
[jonase/eastwood "0.3.14"] | |
[lein-ancient "1.0.0-RC3"] | |
[lein-try "0.4.3"] | |
[lein-cloverage "1.0.13"] |
ClojureによるWeb開発のサーバサイドで注目度の高い(マイクロ)フレームワークとしてDuctがあります。
ちょうど1年前の2017年12月に私自身初めてDuctによる簡単なREST APIを試作してみて、その過程をAdvent Calendar記事にしたことがありました。
今回は主にClojure言語のことを知っていてWebアプリ開発に興味のある方向けに、英語も含めてドキュメントのとても少ないDuctというフレームワークがどのようなものなのか、技術的な詳細に踏み込んだ解説を試みます。
ちなみに、執筆時点で参照/動作確認した各種ライブラリのバージョンは、サンプルプロジェクト"hello-duct"のproject.cljの通りです(Duct最新安定版0.11.2のテンプレートのまま)。
By default, Tailwind's dark mode classes will take effect automatically if the user's operating system is already set to dark mode. Follow these instructions if you would also like to provide a toggle button so the user can override the operating system setting.
Set darkMode: 'class'
in tailwind.config.js
: