Skip to content

Instantly share code, notes, and snippets.

View spacegangster's full-sized avatar
💭
Working on Lightpad.ai

Ivan Fedorov spacegangster

💭
Working on Lightpad.ai
View GitHub Profile
@spacegangster
spacegangster / bem.cljc
Last active November 9, 2020 05:17
Add modifiers to CSS classes as in BEM naming (in Clojure)
(ns space-ui.bem
"Add modifiers to CSS classes as in BEM method.
See rationale here: http://getbem.com/naming/
For BEM with elements see: https://github.com/druids/ccn
Compared to CCN this gist supports maps."
(:require [clojure.string :as str]))
@spacegangster
spacegangster / typography.clj
Created January 28, 2021 10:32
Simple Clojure typography transformations for English, French, and Russian typography styles.
(ns common.typography
"Improve quotes and make whitespace non-breaking after 1-2 letter words"
(:require [clojure.string :as str]))
(def typo-replace-starting-nbsp
[#"(^[a-zA-Z\u0400-\u0500]{1,2})\ ", "$1 "])
(assert (= "A&nbsp;being in Australia <a class='yoy'>"
(apply str/replace "A being in Australia <a class='yoy'>" typo-replace-starting-nbsp)))
@spacegangster
spacegangster / common.match.cljc
Created November 9, 2021 10:20
Simple Clojure[Script] matching function
(ns common.match)
"Example:
(def your-map {:status 200, body 'something}
(m {:status 200} your-map) => true
"
(declare has-matching-values?)