Skip to content

Instantly share code, notes, and snippets.

(with-out-str
(->> 'com.fulcrologic.fulcro.dom-server
ns-publics
(filter #(re-find #"DOM" (or (get (meta (last %)) :doc) "")))
(map first)
(map #(list (str "dom/" %) (list (list "inner" 0))))
;; (take 3)
(clojure.pprint/pprint)))
;; outputs:
@vladkotu
vladkotu / media-query.css
Created December 24, 2019 16:29 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@vladkotu
vladkotu / Readme.md
Created October 2, 2019 06:40 — forked from mhuebert/Readme.md
material-ui's CSS-in-JS with Reagent. (see https://material-ui.com/customization/css-in-js/)

material-ui allows for customizing CSS via a higher-order component called withStyles. Like many higher-order components which expect render props, the purpose of withStyles is to accept some parameters, and then introduce a new variable into the scope of the component tree.

One succinct and simple way to translate the concept of scope into Clojure is via a custom let macro. Usage of such a macro is demonstrated here:

(:require [material-ui.styles :as m])

(m/let [{:keys [leftPad]} {:leftPad 
                           {:paddingLeft 8}}]
 ;; `leftPad` is now the _className_ associated with {:paddingLeft 8} 
@vladkotu
vladkotu / gist:a27abe0427596b8a0a84778c661853d3
Created July 10, 2019 12:36 — forked from TessMyers/gist:a252520dd9a8fe68f8e5
Simple exercises using .map and .reduce
// Simple problems to solve using the native .reduce and .map array methods. Each of these problems can be solved in many
// different ways, but try to solve them using the requested higher order function.
// MAP
// Write a function capitalize that takes a string and uses .map to return the same string in all caps.
// ex. capitalize('whoop') // => 'WHOOP'
// ex. capitalize('oh hey gurl') // => "OH HEY GURL"
var capitalize = function(string){
// code code code!
@vladkotu
vladkotu / kill-on-port-3000.sh
Created September 5, 2017 08:59
find process that takes port and kill it
lsof -i :3000
#COMMAND PID ...
#node 20638 ...
#node 20638 ...
sudo kill -9 20638
@vladkotu
vladkotu / repl-helpers.clj
Last active June 17, 2017 17:45
clojure repl: search for namespaces on classpath and runtime, explore java underworld
(ns user
(:require [clojure.java.classpath]
[clojure.tools.namespace]
[clojure.repl :refer :all]
[clojure.pprint :refer [pprint]]
[lucid.mind :refer [.? .* .%> .%]])
(:import [java.util.jar.JarFile]))
;Read more on lucid.mind http://docs.caudate.me/lucidity/lucid-mind.html
;(.%> clojure.lang.PersistentVector)
;/*
;const result = {
; usd: [10000, 30000],
; gbp: [9000, 0],
; eur: [0, 7000],
; uah: [10000, 0],}
;
;*/
(def transations [[:usd :buy 10000]
const transactions = [
['usd', 'buy', 10000],
['usd', 'sell', 5000],
['gbp', 'buy', 9000],
['eur', 'sell', 7000],
['uah', 'buy', 10000],
['usd', 'sell', 25000],
];
/*

tasks from interview

transactions

Given intup data (transactions)

const transactions = [
    ['usd', 'buy', 10000],
    ['usd', 'sell', 5000],
    ['gbp', 'buy', 9000],
 ['eur', 'sell', 7000],