Skip to content

Instantly share code, notes, and snippets.

View reedho's full-sized avatar

Muhammad Ridho reedho

View GitHub Profile
@reedho
reedho / app.cljs
Last active September 29, 2021 09:12
@leonoel missionary in cljs
;; https://github.com/leonoel/missionary/tree/master/doc/tutorials
(ns my.web.app
(:require [missionary.core :as m]))
;; Basic how the `task` used in practice
(def slow-mo-hello-task
(m/sp (println "hello")
@reedho
reedho / app.cljs
Created September 28, 2021 10:13
Rumext ReactRouter v5
;; https://reactrouter.com/web/example/auth-workflow
;; ported to cljs with rumext
;; 28-Sep-2021
;; Ridho
(ns my.web.app
(:require ["react" :as react :refer [createContext useContext]]
["react-dom" :as react-dom]
[rumext.alpha :as mf]
[applied-science.js-interop :as j]
@reedho
reedho / init.el
Last active September 22, 2021 06:58
My spacemacs init.el
; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@reedho
reedho / clojure_data_xml_usage.clj
Created June 10, 2019 07:51
Clojure data xml usage
(require '[clojure.data.xml :as xml])
;; `emit-str`
(xml/emit-str
(xml/sexp-as-element
[:Login
[:AgencyCode "agencycode"]
[:Username "XML_Agency"]
[:Password "Password@123"]]))

PART I - Installing PR 540

cd /tmp/
git clone https://github.com/clojure-emacs/cider-nrepl
cd cider-nrepl
git fetch origin pull/540/head:CIDER-NREPL-019
git checkout CIDER-NREPL-019
lein deps
lein install
@reedho
reedho / README
Last active June 12, 2018 06:41
Basic React with Clojurescript :npm-deps (without cljsjs/react) -- React 16.x workaround
Note:
Due to React 16.x react-dom/index conditionally load actual
react-dom implementation based on NODE_ENV,
we have to set it to "production" to make it works.
Note:
For advanced build, we include cljsjs/react* (just) to make use
its provided externs.
Files involved:
@reedho
reedho / cider.el
Created June 8, 2018 07:45
Monkey patching cider tramp can not connect remote ssh 08-Jun-2018
;; ...
(defun cider--infer-ports (host ssh-hosts)
"Infer nREPL ports on HOST.
Return a list of elements of the form (directory port). SSH-HOSTS is a list
of remote SSH hosts."
(let ((localp (or (nrepl-local-host-p host)
(not (assoc-string host ssh-hosts)))))
(if localp
;; change dir: current file might be remote
@reedho
reedho / README.TXT
Last active June 7, 2018 13:26
Basic cljs nrepl setup (June 2018) using clojure tools.deps cli
This work nicely for node repl.
Files involved, contents see below.
1. deps.edn
2. dev/nrepl_server.clj
3. dev/user.clj
Start clojure
$ clojure -A:nrepl-server
@reedho
reedho / README
Created February 28, 2018 07:08
Using clojure cli with cljs browser repl, figwheel & cider nrepl
Run with:
clj -R:repl script.clj
Then connect emacs with `cider-connect`.
@reedho
reedho / user.clj
Last active November 3, 2017 10:42
Converting tiff image to png with jai-imageio
;; Why?
;; Because tiff2png fail with warnings & error like below:
;; TIFFReadDirectory: Warning, Unknown field with tag 37724 (0x935c) encountered.
;; TIFFFetchNormalTag: Warning, Incompatible type for "RichTIFFIPTC"; tag ignored.
;; tiff2png error: don't know how to handle PHOTOMETRIC_SEPARATED (001.tif)
;; Below are somewwat dirty way to do conversion with JAI classes