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 / 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?)
@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 / 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 / user.clj
Last active March 24, 2022 12:16
Getting call graph (vars structure) in Clojure
(ns user)
; Hey, I've been playing a bit with graphing out the structure of a module for Lightpad.
; It worked well, I've found the target function that I'll need change to add a new feature.
; Tweet with a screenshot https://twitter.com/spacegangster/status/1324760381735272450
; lein coordinate
; [com.gfredericks/clj-usage-graph "0.3.0"]
; https://github.com/gfredericks/clj-usage-graph
@spacegangster
spacegangster / rrule.cljc
Last active April 4, 2021 13:24
Parsing and spec-ing recurrence rule rules in Clojure
(ns rrule.rrule
"Parse RRULE as in
https://icalendar.org/iCalendar-RFC-5545/3-3-10-recurrence-rule.html
https://tools.ietf.org/html/rfc5545#section-3.3.10
;; Links ;;
https://github.com/dmfs/lib-recur
https://github.com/jcvanderwal/google-rfc-2445
https://github.com/mangstadt/biweekly
https://github.com/ical4j/ical4j"
@spacegangster
spacegangster / timezones.edn
Last active July 15, 2020 14:52
List of standard timezones, scraped from a popular mailing service
;; UPD hey, I'm not sure now if those zones are correct throughout the year
;; see this https://www.creativedeletion.com/2015/01/28/falsehoods-programmers-date-time-zones.html
;; Sorry for misleading you
[{:option/value "Pacific/Tarawa" :option/label "(GMT +12:00) Tarawa"}
{:option/value "Pacific/Auckland" :option/label "(GMT +12:00) New Zealand Time"}
{:option/value "Pacific/Norfolk" :option/label "(GMT +11:00) Norfolk Island (Austl.)"}
{:option/value "Pacific/Noumea" :option/label "(GMT +11:00) Noumea, New Caledonia"}
{:option/value "Australia/Sydney" :option/label "(GMT +10:00) Australian Eastern Time (Sydney)"}
{:option/value "Australia/Queensland" :option/label "(GMT +10:00) Australian Eastern Time (Queensland)"}
{:option/value "Australia/Adelaide" :option/label "(GMT +9:30) Australian Central Time (Adelaide)"}
[:dev] Compiling ...
[:dev] Build failure:
failed to convert sources
{:tag :shadow.build.closure/convert-error, :sources [[:shadow.build.classpath/resource "website/js-main.js"]]}
ExceptionInfo: failed to convert sources
shadow.build.closure/convert-sources*/fn--11183 (closure.clj:1462)
shadow.build.closure/convert-sources* (closure.clj:1432)
shadow.build.closure/convert-sources* (closure.clj:1315)
shadow.build.closure/convert-sources (closure.clj:1649)
@spacegangster
spacegangster / examples.edn
Last active July 10, 2019 09:35
Crux Console examples
[{:title "Space Stocks"
:query {:find [e]
:where [[e :crux.db/id _]]}}
{:title "Add space stocks"
:query [[:crux.tx/put {:crux.db/id 33 :title "Company 3"}]]}]

Keybase proof

I hereby claim:

  • I am spacegangster on github.
  • I am spacegangster (https://keybase.io/spacegangster) on keybase.
  • I have a public key ASBcpD-OPG3YQxM-E_m9qD9j97TQ6NYyb5mwssBeEIqD6go

To claim this, I am signing this object:

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");