Skip to content

Instantly share code, notes, and snippets.

View featalion's full-sized avatar

Yury Yantsevich featalion

  • Klarna Bank AB
  • Stockholm
View GitHub Profile
(ns spec-test
(:require [clojure.string :refer [lower-case blank?]]
[clojure.spec :as s]
[buddy.hashers :as hsh]
[compojure.core :refer [defroutes POST]]
[korma.core :as dbc]
[taoensso.timbre :as log]
[postgre.models :refer [users]]))
;;; Utils
@featalion
featalion / incanter-view-on-top.clj
Last active June 15, 2016 16:09
Show Incanter chart on top of the screen
(use '(incanter core stats charts))
;; unfortunately, this solution does not focus chart window (at least, on MacOSX)
;; it means, that you should use mouse to close a window
(defn view-on-top [obj & opts]
(doto (apply view obj opts)
(.setAlwaysOnTop true)
(.requestFocus)
(.setAlwaysOnTop false)))
@featalion
featalion / cider-incanter-hack.el
Created June 15, 2016 00:52
Interactive command to make and to show Incanter chart in separate Emacs window and buffer. It preserves current cursor's position.
(require 'cider)
(setq incanter-temp-chart-file "/tmp/chart.png")
(setq incanter-wait-time 500)
(defun incanter-display-image-inline (buffer-name file-name)
"Use `BUFFER-NAME' to display the image in `FILE-NAME'.
Checks weather `BUFFER-NAME' already exists, and if not create
as needed."
(switch-to-buffer-other-window buffer-name)
@featalion
featalion / compare.clj
Created August 29, 2015 00:51
Comparison of old and new functions of nuday.utils.maps
;;; make & evaluate 4000 maps: {0 0}, {0 0, 1 1}, {0 0, 1 1, 2 2}, etc.
(def maps (doall
(map (fn [n]
(let [rng (range (inc n))]
(zipmap rng rng)))
(range 4000))))
(defn mfilter-old [f input]
(when input
(->> input ; uses macro
class AttMed {
private int attention = 0;
private int meditation = 0;
AttMed() {}
public []int toArray() {
return {this.attention, this.meditation};
}
}
package main
import (
"fmt"
"github.com/iron-io/iron_go/config"
"github.com/iron-io/iron_go/mq"
)
func main() {
conf := config.Presets["mq"]