Skip to content

Instantly share code, notes, and snippets.

View rafd's full-sized avatar
🐃
yak-shaving

Rafal Dittwald rafd

🐃
yak-shaving
View GitHub Profile
config defaultToCurrentScreen true
config secondsBetweenRepeat 0.1
# Shows app icons and background apps, spreads icons in the same place.
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
config checkDefaultsOnLoad true

Keybase proof

I hereby claim:

  • I am rafd on github.
  • I am rafd (https://keybase.io/rafd) on keybase.
  • I have a public key whose fingerprint is EBA3 A5E8 1283 8FE9 CAD4 466C 8DE4 A7A0 89D8 002F

To claim this, I am signing this object:

@rafd
rafd / bot.js
Created November 14, 2015 21:03
tic tac toe bot
var last = function(arr) {
return arr[arr.length - 1];
}
var coordinate1 = function(state) {
return last(state["history"])["move"][1];
}
var firstFromSquare = function(square_arr){
for(var i = 0; i < square_arr.length; i++){
@rafd
rafd / om-example.cljs
Last active January 11, 2016 08:27
om-next-routing-example
(defmethod read :episodes/all
[{:keys [state query]} _ _]
(let [episodes (->> (d/q '[:find (pull ?entity ?pattern)
:in $ ?pattern
:where [?entity :episode/name]]
@state
query)
(map first)
vec)]
(if (seq episodes)
@rafd
rafd / gist:a5e78d8d70859a659cff8b732319d69e
Created July 4, 2017 15:51
Graphing with Reagent + SVGs
(ns dota2viz.client.graph
(:require
[clojure.string :as string]))
(defn interpolate
[x [x0 x1] [y0 y1]]
(+ y0 (/ (* (- x x0)
(- y1 y0))
(- x1 x0))))
@rafd
rafd / livecode.clj
Created September 14, 2020 21:11
clojodojo-2020-09-14
(ns demo)
(defn hello []
"sagasgd x")
(defonce run? (atom true))
(defn run []
(future
(Thread/sleep 1000)
@rafd
rafd / cleave.clj
Created July 21, 2021 00:53
clojure meetup 2021-07-20
(cleave 5 [#(* % 2) dec #(* % %)])
;; => [10 4 25]
(defn cleave [x fs]
((apply juxt fs) x))
(defn cleave2 [x fs]
(map #(% x) fs))
@rafd
rafd / marketplace.clj
Created August 5, 2021 01:11
ClojoDojo 2021-07-04
(ns exercises.marketplace)
;; there is marketplace of vendors
;; each offering a certain amount of foos for bars
;; want to be able to convert from foos to bars
;; function 1 - show cost of converting some number of foos to bars, via multiple trades in marketplace (ex. 2 foo => 5 bars)
;; function 2 - path to achieve that conversion 1 foo => 4 cats => 2 zigs => 25 bars
(def offers
[{:from [4 :banana]
@rafd
rafd / september.clj
Created September 2, 2021 01:09
Clojure Meetup September
(ns exercises.september
(:require [criterium.core :as criterium]))
#_(+ 1 2 3)
#_(println "asdasd")
(defn clamp [v min max]
(cond
(< v min) min
(ns exercises.core
(:require
[clojure.walk :as walk]))
;; trie
; "hello"
; "hi"
; "he"