Skip to content

Instantly share code, notes, and snippets.

View martinklepsch's full-sized avatar
👀
Hacking on ctxs.ai

Martin Klepsch martinklepsch

👀
Hacking on ctxs.ai
View GitHub Profile
#lang racket/base
(provide line-loop)
(require racket/class)
(require (prefix-in gen/ racket/generic))
;; Feels like a lightweight approach but getting
;; struct fields can be very verbose
(gen/define-generics progressable
racket-minimal = stdenv.mkDerivation rec {
name = "racket-minimal-${version}";
version = "6.2.1";
src = fetchurl {
url = "http://mirror.racket-lang.org/installers/${version}/${name}-src-builtpkgs.tgz";
# "http://mirror.racket-lang.org/installers/${version}/${name}-src.tgz";
sha256 = "0dkbr2cqkalh1v46p37m4xi7mcgwkzc4v90gclwsjrmb4dgypv27";
};
@martinklepsch
martinklepsch / logging.cljc
Last active July 2, 2024 13:37
simple Clojurescript logging using Google Closure logging tools
;; This previously was CLJX but has now been updated to use cljc. Thanks @caskolkm
;; https://gist.github.com/caskolkm/39d823f5bac7051d3062
(ns app.logging
(:refer-clojure :exclude [time])
(:require #?(:clj [clojure.tools.logging :as log]
:cljs [goog.log :as glog]))
#?(:cljs (:import goog.debug.Console)))
#?(:cljs
@martinklepsch
martinklepsch / client.clj
Last active November 26, 2023 20:36
A minimal Clojure client for Airtable.com's HTTP API.
(ns oxygen.client
"A minimal Clojure client for Airtable.com's HTTP API.
Supports retrieval of whole tables as well as individual records.
Dependencies: [org.clojure/data.json \"0.2.6\"] [clj-http \"2.0.0\"]"
(:require [clojure.data.json :as json]
[clojure.string :as string]
[clojure.set :as set]
[clj-http.client :as client]))
(def api-base "https://api.airtable.com/v0")
@martinklepsch
martinklepsch / cljs-js-analysis-cache-usage.md
Last active August 29, 2015 14:26 — forked from mhuebert/cljs-js-analysis-cache-usage.md
Using existing namespaces from cljs.js

Let's say you want to use the new cljs.js bootstrapped compiler to eval code in your project. Using cljs.js/eval looks like this:

(ns foo.try-eval
  (:require [cljs.js :as cljs]))

(let [c-state (cljs/empty-state)]
  (cljs/eval c-state                       ;compiler state
             `(+ 1 1)`                     ;form to eval
 {:eval cljs/js-eval ;options
#!/usr/bin/env ruby
# Copyright (C) 2012 Alex Sayers <[email protected]>. All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.
# Adapted from Lastpass to Passpack usage by Martin Klepsch <[email protected]>
#
# Passpack Importer
#
# Reads CSV files exported from Passpack and imports them into pass.
#

ClojureBerlin 2015.05.13

(ns ui.flag
(:require [reagent.core :as reagent :refer [atom]]))
(defn flag
"Simple flag object component as described by Harry Roberts:
http://csswizardry.com/2013/05/the-flag-object"
[& {:keys [image bodies]}]
[:div.flag
[:div.flag__image image]
(for [b bodies]
(defn check-policies
(defn fmt-seconds [n-seconds]
(tf/unparse (tf/formatter "HH:mm:ss")
(t/plus (t/date-time 0) (t/seconds n-seconds))))