Skip to content

Instantly share code, notes, and snippets.

View yogthos's full-sized avatar
🤷‍♂️

Dmitri Sotnikov yogthos

🤷‍♂️
View GitHub Profile
@yogthos
yogthos / gist:520ca019cf78ac12c6df
Last active February 13, 2016 05:00
sea monster
_..--+~/@-@--.
- ( ^ )
==~ ....
- --=.\ \
-~ _. \ \ _\
- - ,__,
=
' =
: : .
@yogthos
yogthos / help-wanted.md
Created October 7, 2015 00:07
projects with some labeled low hanging fruit issues
@yogthos
yogthos / The Technical Interview Cheat Sheet.md
Last active October 29, 2017 06:27 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@yogthos
yogthos / regex-text.clj
Created August 24, 2015 18:07
ClojureScript re-find and clojure.string/replace inconsistency
;;Clojure
(re-find #"(?i)ol" "HOLA")
;=>"OL"
(clojure.string/replace "HOLA" #"(?i)ol" "EY")
;=>"HEYA"
;;ClojureScript
(re-find #"(?i)ol" "HOLA")
;=>"OL"
(clojure.string/replace "HOLA" #"(?i)ol" "EY")
@yogthos
yogthos / gist:7b6ab07449d9b40abc5f
Created July 9, 2015 15:50
reagent dynamic lists/tables
(def doc (atom {:items ["foo" "bar" "baz"]
:table-items [["foo" "bar" "baz"]
["blah" "bleh" "blub"]]}))
(defn remove-at [v i]
(vec (into (subvec v 0 i) (subvec v (inc i) (count v)))))
(defn list-field []
[:div
[:ul
(defn gen-name [k l]
(loop [n #(mod (* 399 %) 509)
r (nth "BDGKPNTVZ" (mod (n k) 9))
k k
i 0]
(if (< i l)
(recur n
(str r (-> ["aeiouaeio" "bdgknptvwz"] (nth (bit-and i 1)) (nth (mod (n k) 9))))
(n k)
(inc i))
@yogthos
yogthos / ui
Last active August 29, 2015 14:18
(def messages (atom ["message 1" "message 2" "message 3"]))
(defn side-bar []
(let [users (atom ["Bob" "Jane" "Alice"])
selected-user (atom nil)]
(fn []
[:ul.list-group
(into
[:ul]
(map
@yogthos
yogthos / tinyurl.clj
Created April 1, 2015 12:42
short unique ID generator
(def dict-16 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F])
(def dict-32 [\1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \J \K \M \N \P \Q \R \S \T \U \V \W \X \Y \Z])
(def dict-64 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z])
(def dict-89 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z \+ \" \@ \* \# \% \& \/ \| \( \) \= \? \~ \[ \] \[ \} \$ \- \_ \. \: \space \, \; \< \>])
(defn encode [dict value]
(let [base (-> dict count str BigInteger.)]
@yogthos
yogthos / ascii_table.clj
Created March 5, 2015 16:02
ascii table renderer for clj-pdf table format
(ns ascii-table)
(defn transpose [m]
(apply mapv vector m))
(defn col-width [rows text-width]
(let [num-cols (-> rows first count)]
(int (/ (- text-width 2 (dec num-cols)) num-cols))))
(defn height [length width]
@yogthos
yogthos / gist:838a2ab5653835a30b8d
Last active August 29, 2015 14:11
Guestbook app

Creating a guestbook application

install the Leiningen build tool

wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x lein

create a new project