Skip to content

Instantly share code, notes, and snippets.

(require '[reagent.core :as r])
(defn i []
(let [dims (r/atom {})
this (r/atom nil)]
(fn [][:div
[:img {:style {:width :100%}
:src "http://www.lispcast.com/img/pre-conj/rich-hickey.jpeg"
:ref (fn [x] (reset! this x))
:on-load
@pesterhazy
pesterhazy / git xargs.md
Last active November 25, 2022 09:11
git xargs: execute utility on files under source control

git xargs: execute utility on files in repository

Provides a new git command, git xargs, that runs an arbitrary shell command on all files under source control. Optionally you can specify a pathspec (such as a subpath or a glob expression), restricting the operation to a subset of the repository files.

As git xargs delegates the work to xargs(1), it supports all options provided by the version of xargs installed on your system.

Installation

@pesterhazy
pesterhazy / reagent-rn-list-view.cljs
Created January 15, 2017 16:00
Reagent react-native list-view
(def list-view (r/adapt-react-class (.-ListView js/React)))
; use sg-list-view instead of list-view for better performance
; in long lists
;
; (def sg-list-view* (r/adapt-react-class (js/require "react-native-sglistview/lib/SGListView.js")))
;
;(defn sg-list-view
; "Adds some defaults to sg-list-view*"
; [m]
@pesterhazy
pesterhazy / lumo-deps
Last active February 10, 2017 10:05
Run lumo with ClojureScript (maven) or JavaScript (npm) dependencies
#!/usr/bin/env python
#
# lumo-deps: lumo with JavaScript or ClojureScript dependencies
#
# Synopsis:
#
# lumo-deps [-c clojure-dep] [-j javascript-dep] [-- lumo-opt1 lumo-opt2 ...]
#
# Starts a lumo session with ClojureScript or JavaScript dependencies loaded.
#
@pesterhazy
pesterhazy / error_boundary_test.cljs
Last active May 13, 2017 11:48
Testing pesterhazy/recalcitrant error-boundary for reagent
;loaded from gist: https://gist.github.com/pesterhazy/60ec2b43709bbc8d8a7c324077466df1
(ns my.test
(:require [reagent.core :as r]
[reagent.impl.component :as comp]
[reagent.impl.util :as util]
[reagent.debug :refer-macros [dev?]]
[goog.object :as gobj]))
(enable-console-print!)
@pesterhazy
pesterhazy / select.cljs
Last active December 10, 2022 03:17
Using react-select with reagent
;; in your project definition
;; [cljsjs/react-select "1.0.0-rc.1" :exclusions [cljsjs/react]]
;; See react-select documentation: https://github.com/JedWatson/react-select
(ns example.select
(:require [reagent.core :as r]
[cljsjs.react-select]))
(defn select
@pesterhazy
pesterhazy / reagent-react-virtualized.cljs
Last active October 1, 2020 21:16
react-virtualized used from reagent
;; [cljsjs/react-virtualized "7.11.8-1" :exclusions [cljsjs/react]]
(ns react-virtualized.example
(:require [cljsjs.react-virtualized]
[clojure.string]
goog.date.DateTime
[reagent.core :as r]))
(defn fmt-value [v]
(cond
@pesterhazy
pesterhazy / es6-class-react.cljs
Last active August 17, 2018 13:14
React component in pure cljs using ES6 class inheritance
;; implementing a React component in pure cljs, no reagent necessary
;; using goog.object.extend to create a ES6 class that inherits from
;; React.Component
;; credit to @thheller
(defn MyReact [props context updater]
(this-as this
(js/React.Component.call this props context updater)))
@pesterhazy
pesterhazy / bookmarklet.md
Last active February 11, 2017 20:00
bookmarklet.md

Hello

bookmarklet

@pesterhazy
pesterhazy / clojured-2017-beers.md
Last active February 23, 2017 10:29
(Unofficial) ClojureD Pre-Conference Beers

(Unofficial) :clojureD Pre-Conference Beers

We're getting together for pre-conference 🍻

on Friday 24th 2017 from 7 PM

at Trespassers (http://trespassers.eu/). Trespassers also serves snacks like Tamales.

How to find us?