Skip to content

Instantly share code, notes, and snippets.

View alehatsman's full-sized avatar
🐶

Aleh Atsman alehatsman

🐶
View GitHub Profile
export default function bfs(head: BinaryNode<number>, needle: number): boolean {
return walk([head], needle);
}
function walk(queue: BinaryNode<number>[], needle: number): boolean {
const node = queue.shift();
if (!node) {
return false;
}
@alehatsman
alehatsman / snowflake_access.clj
Last active November 2, 2021 14:56
snowflake clojure access
;{:paths ["src"]
; :deps
; {org.clojure/clojure {:mvn/version "1.10.3"}
; com.github.seancorfield/next.jdbc {:mvn/version "1.2.674"}
; net.snowflake/snowflake-jdbc {:mvn/version "3.13.9"}}}
(ns main
(:require [next.jdbc :as jdbc]
[clojure.string :as string]))
@alehatsman
alehatsman / deps.edn
Created August 13, 2020 09:28 — forked from pyrmont/deps.edn
Figwheel setup with Conjure
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
org.clojure/clojurescript {:mvn/version "1.10.597"}}
:paths ["src" "resources"]
:aliases {:fig {:extra-deps
{com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
com.bhauman/figwheel-main {:mvn/version "0.2.4"}}
:extra-paths ["target" "test"]}
:build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}
:min {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
:release {:main-opts ["-m" "figwheel.main" "-bo" "release"]}
@alehatsman
alehatsman / colorscheme-override.md
Created April 24, 2020 08:53 — forked from romainl/colorscheme-override.md
The right way to override any highlighting if you don't want to edit the colorscheme file directly

The right way to override any highlighting if you don't want to edit the colorscheme file directly

Suppose you have weird taste and you absolutely want:

  • your visual selection to always have a green background and black foreground,
  • your active statusline to always have a white background and red foreground,
  • your very own deep blue background.

Your first reflex is probably to put those lines somewhere in your vimrc:

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@alehatsman
alehatsman / async.cljs
Created August 8, 2018 09:55
ClojureScript throttle and debouce functions
(ns async
(:import [goog.async Throttle Debouncer]))
(defn disposable->function [disposable listener interval]
(let [disposable-instance (disposable. listener interval)]
(fn [& args]
(.apply (.-fire disposable-instance) disposable-instance (to-array args)))))
(defn throttle [listener interval]
(disposable->function Throttle listener interval))
@alehatsman
alehatsman / Aleph get json
Created July 28, 2017 11:22
Aleph http client get request and parse body from json to clojure map.
(require '[aleph.http :as http]
'[byte-streams :as bs]
'[cheshire.core :as cheshire]
'[manifold.deferred :as d])
(defn input-stream-to-buffered-reader [is]
(new BufferedReader (new InputStreamReader is)))
(defn parse-json-input-stream [is]
(-> (input-stream-to-buffered-reader is)
@alehatsman
alehatsman / vim_fireplace_paredit_cheat_sheet.md
Created July 21, 2017 09:20 — forked from nblumoe/vim_fireplace_paredit_cheat_sheet.md
Simple cheat sheet for vim fireplace and paredit

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window
@alehatsman
alehatsman / twitter-wipe.clj
Created April 10, 2017 12:33
Remove all tweets from twitter. Requires to create app in twitter developer.
(ns tweet-wipe.core
(:use [twitter.oauth]
[twitter.callbacks]
[twitter.callbacks.handlers]
[twitter.api.restful])
(:import [twitter.callbacks.protocols SyncSingleCallback])
(:gen-class))
(def number-of-tweets 200)