Skip to content

Instantly share code, notes, and snippets.

@clartaq
clartaq / wc.clj
Created Jun 15, 2020
Clojure Namespace to Count Words in Markdown Text
View wc.clj
;;;;
;;;; This namespace includes utility functions to count the number of words
;;;; in a file of Markdown text.
(ns cwiki.util.wc
(:require [clojure.string :as s]))
(defn strip-html-comments
"Return a version of the input text with HTML comments removed."
[text]
@clartaq
clartaq / font-detection.cljs
Last active Jun 6, 2019
Detecting Installed Fonts with ClojureScript
View font-detection.cljs
;;;;
;;;; Utilities to help with determining what if particulare fonts are
;;;; installed on the client system.
;;;;
(ns cwiki-mde.font-detection
(:require [clojure.string :as string]))
;; Filled in during loading of namespace.
(def measured-font-widths (atom {}))
@clartaq
clartaq / CWikiLinkRenderer.java
Created Dec 16, 2018
Custom flexmark-java LinkRenderer for CWiki (not used)
View CWikiLinkRenderer.java
package cwiki.extensions;
import com.vladsch.flexmark.ext.wikilink.WikiLink;
import com.vladsch.flexmark.ext.wikilink.internal.WikiLinkOptions;
import com.vladsch.flexmark.html.CustomNodeRenderer;
import com.vladsch.flexmark.html.HtmlWriter;
import com.vladsch.flexmark.html.renderer.*;
import com.vladsch.flexmark.util.options.DataHolder;
import com.vladsch.flexmark.util.sequence.BasedSequence;
@clartaq
clartaq / WikiLinkAttributesTest.clj
Last active Sep 5, 2018
Wikilink Attributes Extension for flexmark written in Clojure
View WikiLinkAttributesTest.clj
(ns cwiki.test.util.WikiLinkAttributesTest
(:require [clojure.test :refer :all]
[cwiki.util.wikilink-attributes])
(:import (com.vladsch.flexmark.util.options MutableDataSet)
(com.vladsch.flexmark.parser Parser Parser$Builder)
(com.vladsch.flexmark.html HtmlRenderer HtmlRenderer$Builder)
(com.vladsch.flexmark.ext.wikilink WikiLinkExtension)
(cwiki.util WikiLinkAttributeExtension)
(java.util ArrayList)))
@clartaq
clartaq / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.