Skip to content

Instantly share code, notes, and snippets.

Focusing on

Ido Barkan barkanido

Focusing on
Block or report user

Report or block barkanido

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
barkanido / match_example.clj
Created May 13, 2019
beware of clojure.core.match
View match_example.clj
(match/match [a b]
[_ true] :first
[true false] :second
[_ false] :third)
(= b true) :first
(= b false) (try
barkanido /
Created Apr 2, 2019
multi fprmatter (parser) for timstamps in java 8 time aPI
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
public class Main {
barkanido / core.clj
Last active Mar 10, 2019
testing url query string parsing in clojure
View core.clj
(ns toy-url-decoder.core
(:require [cemerick.url :as c-url]
[criterium.core :as crit])
(:import [ URI URL]
[io.netty.handler.codec.http QueryStringDecoder]
[java.nio.charset Charset]
[org.apache.http.client.utils URLEncodedUtils]
[org.apache.http NameValuePair]
[java.util List Map Map$Entry]))
View transcoder-get.clj
user=> (aero/put c "index" "set-name" 42 1000)
<< … >>
user=> (defn inc-transcoder [rec] (when rec
#_=> (update rec :payload inc)))
user=> (d/chain (aero/get-single c "index" "set-name" {:transcoder inc-transcoder})
#_=> :payload
#_=> println)
<< … >>
View transcoder-put.clj
user=> (aero/put c "17" "set-name" 1 1000 {:transcoder str})
<< … >>
View client-events.clj
(ns af-common-rta-aerospike.core
(:require [aerospike-clj.client :as aero]
[statsd.metrics :as metrics]
[statsd.core :as statsd]
[manifold.deferred :as d]))
(defrecord DBMeter []
(on-success [_ op-name op-result _index op-start-time client]
(statsd/send-timing (metrics/format-statsd-metric (:cluster-name client) op-name "latency")
View aero-record.clj
user=> @(aero/get-single c "index" "set-name")
#aerospike_clj.client.AerospikeRecord{:payload 42, :gen 1, :ttl 285167713}
View aero-putget.clj
user=> (aero/put c "index" "set-name" 42 1000)
<< … >>
user=> (def f (aero/get-single c "index" "set-name"))
user=> (d/chain (aero/get-single c "index" "set-name")
#_=> :ttl
#_=> aero/expiry-unix
#_=> #(java.time.Instant/ofEpochSecond %)
#_=> str
#_=> println)
barkanido / aero-client.clj
Created Jan 23, 2019
create aerospike client
View aero-client.clj
user=> (require '[aerospike-clj.client :as aero])
user=> (def c (aero/init-simple-aerospike-client ["localhost"] "test"))
;; Starting aerospike clients for clusters localhost with username null
You can’t perform that action at this time.