Skip to content

Instantly share code, notes, and snippets.

View onetom's full-sized avatar

Tamas Herman onetom

View GitHub Profile
@onetom
onetom / common.cljc
Created September 3, 2024 07:56
Probe in Clojure
(ns common
"This namespace was made to provide utilities, which would be used often enough
in both clj & cljs, but they are either not available in `clojure.core`
& `cljs.core` OR they are available slightly differently and this namespace
allows writing code with less reader-conditionals."
(:require
[medley.core :as medley]
#?@(:cljs
[[oops.core :refer [gcall]]
;; https://martinklepsch.org/posts/requiring-closure-namespaces.html
@onetom
onetom / dialog.clj
Created June 30, 2023 17:49
Pop up an Apple Script Yes/No dialog from Clojure
(ns dialog
"Display a Yes/No dialog, which appears on the very top of every app and grabs
the focus and also gives it back to the REPL, after making the choice, unlike
a Swing dialog, for example.
It's useful for confirming irreversible operations, like file or DB deletion.
It uses AppleScript, so it only works on macOS and on a local REPL."
(:require
[clojure.java.shell :as shell]))
@onetom
onetom / better-deftest.clj
Last active October 27, 2022 18:58
Monkey-patch Kaocha to print Cursive-recognisable stack traces & more readable `nubank/matcher-combinators` diffs
;; Discussion: https://clojurians.slack.com/archives/C0744GXCJ/p1666889779101459
(ns demo.better-deftest
(:require [clojure.test :refer :all]))
(deftest default-stack-trace-test
(is (throw (Exception. "BAMM"))))
(clojure.test/run-test default-stack-trace-test)
@onetom
onetom / Vivaldi-100%cpu-crash-report.txt
Created June 26, 2019 04:36
Vivaldi 100% CPU usage crash report
Process: Vivaldi [38254]
Path: /Applications/Vivaldi.app/Contents/MacOS/Vivaldi
Identifier: com.vivaldi.Vivaldi
Version: 2.6.1566.44 (2.6.1566.44)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Vivaldi [38254]
User ID: 501
Date/Time: 2019-06-26 12:25:27.944 +0800
@onetom
onetom / Ethereum address
Created November 9, 2017 03:02
Rinkeby address
fb7e3403a9651a72b18c82b485fe4d935a7810b7
@onetom
onetom / keybase.md
Created August 4, 2017 17:01
keybase.md

Keybase proof

I hereby claim:

  • I am onetom on github.
  • I am onetom (https://keybase.io/onetom) on keybase.
  • I have a public key ASBt3f5yrZQatmEs5FIoairtyd6XqVBSZjuxeZzrfcLCdQo

To claim this, I am signing this object:

@onetom
onetom / rpc.cljs.hl
Created September 12, 2016 15:28 — forked from micha/rpc.cljs.hl
(ns app.rpc
(:require-macros
[adzerk.env :as env])
(:require
[ui.util :as util]
[ui.paging :as p :refer-macros [defp]]
[castra.core :as castra :refer [mkremote]]))
(env/def
GEIR_BRANCH nil
@onetom
onetom / paging.clj
Created September 12, 2016 15:27 — forked from micha/paging.clj
(ns ui.paging
(:require [hoplon.core :refer (def-values)]))
(defmacro defp
[name & args]
`(def ~name (paginate ~@args)))
@onetom
onetom / dates.cljc
Created September 12, 2016 15:26 — forked from Deraen/dates.cljc
Cljc dates
(ns metosin.dates
"Use this namespace to format dates and datetimes for user.
Don't use for serializing or deserializing.
Clojure side uses always Helsinki timezone.
On Cljs side, uses the timezone of browser."
#?(:cljs (:require goog.date.UtcDateTime
goog.date.Date
goog.i18n.DateTimeFormat))
#?(:clj (:import [org.joda.time DateTimeZone])))
@onetom
onetom / auth_core.clj
Created May 4, 2016 08:46
Minimal Castra client
(ns auth-core
(:require-macros
[hoplon.core :refer [with-init! defelem]]
[javelin.core :refer [defc defc= cell= dosync]]
[compile-time-config :refer [env]])
(:require
[hoplon.core :refer :all]
[hoplon.storage-atom :refer [local-storage]]
[javelin.core :refer [cell]]
[castra.core :refer [mkremote assoc-when xhr-resp-headers]]