Skip to content

Instantly share code, notes, and snippets.

@hugoduncan
hugoduncan / primitive_predicate.clj
Created April 11, 2021 13:30
Predicate for testing whether a value is primitive in clojure
(definterface IPrimitive
(is_primitive [^boolean x])
(is_primitive [^float x])
(is_primitive [^double x])
(is_primitive [^int x])
(is_primitive [^long x])
(is_primitive [^Object x]))
(deftype IsPrimitive []
IPrimitive

Keybase proof

I hereby claim:

  • I am hugoduncan on github.
  • I am hugoduncan (https://keybase.io/hugoduncan) on keybase.
  • I have a public key ASDseSq5a9GjSqrnIsEMf3Ga_qvOzbvm9uamhZD2yQ3nCgo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1MRCNmVgM2t3mryyaknMZagM9Rxdvs1v6K https://explorer.blockstack.org/address/1MRCNmVgM2t3mryyaknMZagM9Rxdvs1v6K
@hugoduncan
hugoduncan / list_view.clj
Last active February 7, 2016 04:03
Using a React Native ListView with om.next
(list-view
{:dataSource (clone-with-rows
data-source
(clj->js
(mapv #(assoc % :omcljs$meta (pr-str (meta %)))
objects)))
:renderRow (fn objects-render-r-row [row section-id row-id]
(let [row (j->c row)
m (:omcljs$meta row)
m (if m (reader/read-string m))
@hugoduncan
hugoduncan / core-docker.service
Last active August 29, 2015 14:06
Fleet services for switching to latest docker on CoreOS, and back again
# core-docker.service
# Fleet global unit to restore docker to the CoreOS version
[Unit]
Wants=docker.service
After=docker.service
[Service]
Type=oneshot
ExecStart=/usr/bin/rm -f /run/systemd/system/docker.service.d/10-start.conf
<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>target</key>
<defaultValue>unspecified</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${target}" class="ch.qos.logback.core.FileAppender">
<file>logs/target-${target}.log</file>
<append>false</append>
<encoder>
{:namespaces ({:vars ({:ns hyde-pallet-crate.core,
:name build-site,
:file "hyde_pallet_crate/core.clj",
:column 1,
:line 61,
:var-type :fn,
:arglists ([root jekyll-config site-config])}
{:ns hyde-pallet-crate.core,
:name site-config,
:file "hyde_pallet_crate/core.clj",
{:namespaces ({:vars ({:ns palletops.hyde,
:name gemfile,
:file "palletops/hyde.clj",
:column 1,
:line 65,
:var-type :fn,
:arglists ([config])}
{:ns palletops.hyde,
:name clean-target,
:file "palletops/hyde.clj",
java.net.SocketException: Connection reset
java.net.SocketInputStream.read SocketInputStream.java: 196
java.net.SocketInputStream.read SocketInputStream.java: 122
sun.reflect.NativeMethodAccessorImpl.invoke0 NativeMethodAccessorImpl.java
sun.reflect.NativeMethodAccessorImpl.invoke NativeMethodAccessorImpl.java: 57
sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java: 43
java.lang.reflect.Method.invoke Method.java: 606
clojure.lang.Reflector.invokeMatchingMethod Reflector.java: 93
clojure.lang.Reflector.invokeInstanceMethod Reflector.java: 28
pallet.docker.api/read-r
{:results ({:type :pass, :selector :amzn-linux-2013-092, :service :pallet-ec2, :feature ("default-settings" "install maven")}), :date "20140410T213008.035Z", :untested (:ubuntu-10-04 :ubuntu-12-04 :ubuntu-13-04 :ubuntu-13-10 :centos-6-5 :debian-7-4 :debian-6-0)}