A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
;; Enter your code here. Read input from STDIN. Print output to STDOUT | |
(defun space-split (string) | |
(loop for start = 0 then (1+ finish) | |
for finish = (position #\Space string :start start) | |
collecting (parse-integer (subseq string start finish)) | |
until (null finish))) | |
(defun min-from-list (list &optional (default 1000)) | |
(reduce #'min list :initial-value default)) |
;https://www.hackerrank.com/challenges/halloween-party | |
(defn determine_pieces [number] | |
(if (= (mod number 2) 0) | |
(* (/ number 2) (/ number 2)) | |
(* (quot number 2) (+ (quot number 2) 1)))) ;quot is clojure's version of non-float division | |
(dotimes [i (Integer/parseInt (read-line))] | |
(let [input (Integer/parseInt (read-line))] | |
(println (determine_pieces input)))) |
var obj = {b: 3, c: 2, a: 1}; | |
_.sortKeysBy(obj); | |
// {a: 1, b: 3, c: 2} | |
_.sortKeysBy(obj, function (value, key) { | |
return value; | |
}); | |
// {a: 1, c: 2, b: 3} |
(require '[clojure.core.async :as a]) | |
(def xform (comp (map inc) | |
(filter even?) | |
(dedupe) | |
(flatmap range) | |
(partition-all 3) | |
(partition-by #(< (apply + %) 7)) | |
(flatmap flatten) | |
(random-sample 1.0) |
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
In the Brackets editor, have you noticed that the HTML within <SCRIPT type="text/ng-template">
is not syntax-colored? Here is how to fix it.
AngularJS has support for inline HTML templates. I am going to explain here only how to get the syntax coloring working, not what inline-templates actually are. To create an inline-template, you put the template's HTML into a SCRIPT tag like this:
<SCRIPT type="text/ng-template" id="/path/to/your/template.html">template: {{HTML}} here</SCRIPT>
For most of the tools on here, if you follow the GitHub repos back to the user that owns the repo, they usually have other cool Clojure tools they build. Just a general observation about the Clojure community.
Learnings
Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.
If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.
(ns com.example.bst) | |
; using {:val :left :right} as tree data structure | |
(defn node [val & [left right other]] | |
{:val val :left left :right right :bag other}) | |
(defn insert [parent i-node] | |
(let [i-val (:val i-node) | |
p-val (:val parent) | |
side (cond (> i-val p-val) :left |