Skip to content

Instantly share code, notes, and snippets.

@mfikes
mfikes / perf.md
Last active April 16, 2019 20:46
$ cat src/foo/core.cljs
(ns foo.core)

(prn (time (reduce + (map inc (map inc (range (* 1024 1024)))))))
$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.516"}}}' -m cljs.main -O advanced -c foo.core
$ node out/main.js
{:deps {org.clojure/tools.cli {:mvn/version "0.3.7"}
org.clojure/data.csv {:mvn/version "0.1.4"}
semantic-csv {:mvn/version "0.2.1-alpha1"}}}
@borkdude
borkdude / stopwatch.cljc
Last active October 12, 2018 22:34
core.async stopwatch
(defn stopwatch
"When started, invokes action every ms, until stopped. Reset will
start the stopwatch if it wasn't yet or will reset the timer."
[ms action]
(let [state (volatile! :paused)
started? #(= :started @state)
cmd-ch (a/chan)
start (fn []
(a/go-loop []
(vreset! state :started)
@mfikes
mfikes / clojurists-together-clojurescript.md
Last active December 29, 2023 04:52
Clojurists Together Q2 2018 Funding Round - ClojureScript

This page logs work being done under Clojurists Together Q2 2018 Funding Round towards the ClojureScript project. High level progress reports will be published formally with Clojurists Together, but you can follow here if you are interested in low-level details, progress notes, etc.

Themes

The concrete themes identified include:

  • Fixing CLJS-2702, which prevents us from upgrading to newer versions of Closure Library.
  • Work on highly voted ClojureScript tickets. Please take some time and vote in this list of tickets in need of patches.
  • Work on issues related to NPM dependency management. (In particular NPM issues in the list above will be given extra emphasis).
@tkachenko1503
tkachenko1503 / why-do-we-need-types-in-javascript.md
Last active April 21, 2020 10:35
Do we need types in JavaScript? Or maybe not?

This is my lightning talk submission to ReactiveConf 2018 https://reactiveconf.com/

In this talk, I want to share my experience gained during the development of frontend applications in several programming languages.

I think it's not a secret for anybody that developing large JavaScript applications is not so easy as it seems at first glance. We all want something simpler and more reliable. Therefore, many developers and even entire companies switch to different, compiled in JavaScript, programming languages. The bulk of such transitions is accounted for TypeScript and flow, and often, developers faced with more problems than they were before.

I wasn't the exception. Moving to a new project, I started using TypeScript and was disappointed. Luckily in my next project I used ClojureScript and it was like everything is illuminated!

@animeshtrivedi
animeshtrivedi / ParquetToArrow.java
Last active March 8, 2022 12:04
Example program to convert Apache Parquet data to Apache Arrow
/* This code snippet is a part of the blog at
https://github.com/animeshtrivedi/blog/blob/master/post/2017-12-26-arrow.md
*/
import com.google.common.collect.ImmutableList;
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.*;
import org.apache.arrow.vector.dictionary.DictionaryProvider;
import org.apache.arrow.vector.types.FloatingPointPrecision;
import org.apache.arrow.vector.types.pojo.ArrowType;
@borkdude
borkdude / text_xform.clj
Created September 1, 2017 13:07
Clojure text files transducer
(ns text-xform
(:require [clojure.java.io :as io]
[clojure.string :as str]
[cheshire.core :as json])
(:import [java.io BufferedReader]))
;;;; inspired by https://tech.grammarly.com/blog/building-etl-pipelines-with-clojure
(def db (atom 0))
@camsaul
camsaul / lein-different-jvm.sh
Created March 29, 2017 18:19
Run lein with different JVM
#!/bin/bash
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home lein run
@reborg
reborg / rich-already-answered-that.md
Last active September 25, 2024 17:06
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@thegeez
thegeez / spec_parsing.clj
Last active December 30, 2023 18:17
Parsing with clojure.spec for the Advent of Code challenge
(ns net.thegeez.advent.spec-parsing
(:require [clojure.string :as str]
[clojure.spec :as s]
[clojure.spec.gen :as gen]
[clojure.test.check.generators :as tgen]))
;; Dependencies:
;; [org.clojure/clojure "1.9.0-alpha14"]
;; [org.clojure/test.check "0.9.0"]
;; Advent of Code is a series of code challenges in the form of an advent