Skip to content

Instantly share code, notes, and snippets.

View myguidingstar-zz's full-sized avatar

Hoàng Minh Thắng myguidingstar-zz

View GitHub Profile
@swannodette
swannodette / inference.md
Last active August 7, 2023 16:13
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

@borkdude
borkdude / selector-monitor.boot
Last active August 13, 2016 06:33
Monitor HTML page via CSS selector for change
#!/usr/bin/env boot
;; to run:
;; - install Boot (http://boot-clj.com/). Via brew: brew install boot-clj
;; - save this gist to a file
;; - chmod +x the file
;; - run the file
;; Settings. Change however you like.
(def url "http://www.nu.nl/")
@edolstra
edolstra / nix-ui.md
Last active July 14, 2024 21:22
Nix UI

General notes

  • nix-channel and ~/.nix-defexpr are gone. We'll use $NIX_PATH (or user environment specific overrides configured via nix set-path) to look up packages. Since $NIX_PATH supports URLs nowadays, this removes the need for channels: you can just set $NIX_PATH to e.g. https://nixos.org/channels/nixos-15.09/nixexprs.tar.xz and stay up to date automatically.

  • By default, packages are selected by attribute name, rather than the name attribute. Thus nix install hello is basically equivalent to nix-env -iA hello. The attribute name is recorded in the user environment manifest and used in upgrades. Thus (at least by default) hello won't be upgraded to helloVariant.

    @vcunat suggested making this an arbitrary Nix expression rather than an attrpath, e.g. firefox.override { enableFoo = true; }. However, such an expression would not have a key in the user environment, unlike an attrpath. Better to require an explicit flag for this.

TBD: How to deal with search path clashes.

@mfikes
mfikes / scljs.md
Last active December 29, 2015 10:47
State of ClojureScript

If you look at the 2014 State of ClojureScript survey, these are the top items for What has been most frustrating for you in your use of CLJS?, and my take on work done in these areas is below. It is nothing short of amazing, IMHO.

Therefore I urge you to do the current survey.

  1. Difficulty using ClojureScript REPL: The Node.js REPL was added, as well as a Nashorn REPL, as well as a lot of new "ease-of-use" stuff baked into all base REPLs (doc, pst, etc.). Additionally, a few new ClojureScript REPLs (Ambly, Replete, Planck) rely heavily on new stuff in ClojureScript.
  2. Difficulty debugging generated JavaScript: Source map capability was essentially extended to all REPLs with stack traces automatically being mapped. The
@nbeloglazov
nbeloglazov / instructions.md
Last active August 29, 2015 14:13
Setting up Hatnik to automatically update version in README
  1. Login to http://hatnik.com
  2. Click "Add action".
  3. Enter library.
  4. Change action type to Pull Request.
  5. Enter you repository.
  6. Setup pull request operation: file=README.md, regex={{library}} "[^"]+", replacement={{library}} "{{version}}".
  7. Test pull request if you want to. It will open pull request using "2.3.4" as "new" version for the library. To test pull request use "Test" button.
  8. Click "Create".

Note: Hatnik will not open pull request if version in README is correct, only if you forget to update it next time you do release.

@taylorSando
taylorSando / clj-material-ui
Last active November 18, 2016 11:06
How to use material ui with om
(ns om-material-ui.core
(:require [clojure.string :as str]
[om-tools.dom :as omt]))
(defn kebab-case
"Converts CamelCase / camelCase to kebab-case"
[s]
(str/join "-" (map str/lower-case (re-seq #"\w[a-z]+" s))))
(def material-tags
{:optimizations :advanced
:output-dir "./target/client/production/"
:cache-analysis true
:output-modules {
{:id :common
:out "./resources/assets/js/common.js"
:entries '#{com.foo.common}}
{:id :landing
:out "./resources/assets/js/landing.js"
:entries '#{com.foo.landing}
@runexec
runexec / clojure-transduce-reduce.md
Last active August 16, 2017 22:11
Clojure's Transducers and Reducers

Transducers and Reducers

Notes and examples of Transducers and Reducers

Reducers

  • Used on collections

  • Eager evaluation only. (not lazy)

@elben
elben / understanding-transducers.clj
Last active February 14, 2021 10:55
Understanding Transducers. See README below.
(ns my-transducers.core
(:require [clojure.core.async :as async]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Understanding Transducers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This is the source code for the blog post Understanding Transducers, found
;; here: http://elbenshira.com/blog/understanding-transducers
;;