Skip to content

Instantly share code, notes, and snippets.

View danielcompton's full-sized avatar

Daniel Compton danielcompton

View GitHub Profile
@pesterhazy
pesterhazy / building-sync-systems.md
Last active March 28, 2024 10:54
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@realgenekim
realgenekim / README.md
Last active July 21, 2023 14:29
How to download all Clojure dependencies using clj (equivalent to "lein deps")

I recently had to figure out for a Clojure application how to download all dependency JAR files, for use in a Docker container.

When creating an uberjar, depstar re-downloaded all the external dependencies from Maven central, even though in an earlier Docker build step, I ran clj -Spath to pre-download them (presumably cached into the .m2 directory). In the past, I've used lein deps to do something similiar.

I'm grateful for Sean Corfield helping out (again!!): In short, use clj -P (short for "prepare") to download dependencies. Note the "A:depstar" option, which ensures that the depstar dependencies are downloaded, too.

Here's what it looks like in a Dockerfile:

# to pre-download dependencies, only done if deps.edn changes
@d-t-w
d-t-w / gist:a239dfca4f57b7ff6f38c895b7f45405
Created February 27, 2021 22:21
Intellij Cursive+Cljfmt Editor CodeStyle
<code_scheme name="TW" version="173">
<ClojureCodeStyleSettings>{
:cljs.core/as-&gt; :only-indent
:cljs.core/assoc 0
:cljs.core/cond-&gt; :only-indent
:cljs.core/cond-&gt;&gt; :only-indent
:cljs.core/defonce :only-indent
:cljs.core/with-meta :only-indent
:cljs.core.async/go :only-indent
:cljs.core.async/go-loop :only-indent
@samlambert
samlambert / management.md
Created January 9, 2021 00:16
Management @ PlanetScale

We want PlanetScale to be the best place to work. But every company says that, and very few deliver. Managers have a role in creating an amazing work experience, but things go awry when the wrong dynamic creeps in.

We have all seen those managers who collect people as “resources” or who control information as a way to gain “power.” In these cultures, people who “can’t” end up leading the charge. This is management mediocrity.

What will make us different? At PlanetScale, we won’t tolerate management mediocrity. We are building a culture where politics get you nowhere and impact gets you far. Managers are here to support people who get things done. They are as accountable to their team as their team is accountable to them.

We evaluate managers on the wellbeing and output of their team, how skillfully they collaborate with and influence others, and how inclusively and transparently they work.

You can expect your manager to:

  • Perceive a better version of you and support you in getting there

The case for disabling GH Issues

Disclaimer: This is a personal perspective. The majority of OSS projects I contribute to are libraries and developer tooling. The side effect of this is that if a person is using one of these projects, they have the expertise to understand and modify the code of the project. Also many of the comments made are from my experience, your experience may vary.

The problem with GitHub Issues

Too generic

@myell0w
myell0w / UIView+Hierarchy.swift
Created June 13, 2018 12:05
Traverse View Hierarchy Upwards
extension UIView {
func findFirstSuperview<T>(ofClass viewClass: T.Type, where predicate: (T) -> Bool) -> T? where T: UIView {
var view: UIView? = self
while view != nil {
if let typedView = view as? T, predicate(typedView) {
break
}
view = view?.superview
}
(resource
{:id ::index
:methods
{:post
{:consumes "application/octet-stream"
:consumer (fn [ctx _ body-stream]
(let [f (java.io.File/createTempFile "yada" ".tmp" (io/file "/tmp"))]
(infof "Saving to file: %s" f)
(save-to-file
ctx body-stream
@cgrand
cgrand / core.cljc
Last active October 14, 2020 12:18
Mixing macros and code in cljc and supporting clj, cljs and self-hosted cljs, see https://github.com/cgrand/macrovich
;; SEE: https://github.com/cgrand/macrovich
;; macros and code in a single cljc working across clj, cljs and self-hosted cljs
;; require clojurescript from master
(ns foo.core
#?(:cljs (:require-macros
[net.cgrand.meta-macros :refer [macros no-macros]]
[foo.core :refer [add]])
:clj (:require
@Risto-Stevcev
Risto-Stevcev / spectest.cljs
Last active October 31, 2019 18:53
Some functions to help integrate clojure.spec.test/check with cljs.test/deftest
(ns foo-test
(:require [cljs.spec :as s]
[cljs.spec.test :as stest]
[clojure.pprint :as pprint]
[cljs.test :refer-macros [deftest is]]))
;; Sample function and a function spec
(defn fooo [i] (+ i 20))
(s/fdef fooo