Skip to content

Instantly share code, notes, and snippets.

Avatar

Oliver George olivergeorge

View GitHub Profile
View a-terser.md

package.json

{
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "@blueprintjs/core": "^3.22.0",
    "@blueprintjs/datetime": "^3.15.1",
View app-fx.cljs
(rf/reg-fx ::navigate (fn [a] (navigation/dispatch (navigation/navigate-action a))))
(rf/reg-fx ::navigate2 (fn [[a b]] (navigation/navigate a b)))
(rf/reg-fx ::back (fn [] (navigation/dispatch (navigation/go-back-action))))
(rf/reg-fx ::reset-stack-by-key (fn [m] (navigation/dispatch (navigation/reset-action m))))
(rf/reg-fx ::pop (fn [n] (navigation/dispatch (navigation/pop-action n))))
(rf/reg-fx ::pop-to-top #(navigation/dispatch (navigation/pop-to-top-action)))
View canidatalogtocte.clj
(ns canidatalogtocte
(:require [clojure.java.jdbc :as jdbc]
[clojure.string :as str]
[clojure.spec.alpha :as s]
[datascript.core :as d]
[clojure.test :refer [is]]))
(s/check-asserts true)
(def sqlite-db
View debug_settings.py
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s '
'%(process)d %(thread)d %(message)s'
},
},
@olivergeorge
olivergeorge / repro.md
Last active May 15, 2020
REPL not considering namespace aliases if pre-compiled
View repro.md

Setup is based on clojurescript getting started guide. I've added a require statement to the core ns and using the latest master sha

deps.edn

{:deps {org.clojure/clojurescript {:git/url "https://github.com/clojure/clojurescript.git"
                                   :sha "ec0fc33030ae1858a29c52f38e81fba4180d492b"}}}

src/hello_world/core.cljs

@olivergeorge
olivergeorge / krell-vs-error-boundaries.md
Last active May 10, 2020
Some notes on React error boundaries
View krell-vs-error-boundaries.md

Based on: https://reactjs.org/docs/error-boundaries.html

Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.

As of React 16, errors that were not caught by any error boundary will result in unmounting of the whole React component tree.

Reagent gives us access to the error boundary features

  • Returning true from :component-did-catch stops the unmounting behaviour
View django-subquery-count.md

This was close to useful but the SQL generated has problems with ORDER BY clauses.

The subquery was necessary to avoid GROUP BY problems.

class AG_DATES_OVERLAP(Func):
    function = 'dbo.AG_DATES_OVERLAP'
    template = "%(function)s(%(expressions)s)"
View app_test_runner.cljs
(ns app.test-runner
(:require [clojure.test :refer [deftest is run-tests]]))
(deftest is-this-working?
(is (= 1 2)))
(defmethod cljs.test/report [:cljs.test/default :end-run-tests] [m]
(when-not (cljs.test/successful? m)
(throw "Test failed")))
@olivergeorge
olivergeorge / v1.clj
Created Jan 3, 2020
WIP generating relational db content using clojure.test.check
View v1.clj
(ns v1
(:require [clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[clojure.spec.alpha :as s]))
(defn gen-char [n]
(gen/fmap #(apply str %) (gen/vector gen/char-alphanumeric n)))
(defn gen-varchar [n]
You can’t perform that action at this time.