I hereby claim:
- I am lwhorton on github.
- I am lwhorton (https://keybase.io/lwhorton) on keybase.
- I have a public key ASB18ki5khnROa1xhWw_MiTwxIXHahAD0UgHVOVZfyQq4Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // optimizing this code: | |
| function unusedFunction(note) { | |
| alert(note['text']); | |
| } | |
| function displayNoteTitle(note) { | |
| alert(note['title']); | |
| } | |
| var flowerNote = {}; | |
| flowerNote['title'] = "Flowers"; | |
| displayNoteTitle(flowerNote); |
| (let [arr []] | |
| (type arr) ;; clojure.lang.PersistentVector | |
| (instance? clojure.lang.PersistentVector arr) ;; true | |
| ) | |
| (= 1 "1") ;; false | |
| (= 1 [1]) ;; false | |
| (= 0 false) ;; false | |
| (= "" false) ;; false | |
| (= nil false) ;; false |
| (let [old {:a 1 :b 2} | |
| new-o (assoc old :c 3)] | |
| (prn old) ;; {:a 1 :b 2} | |
| ) | |
| (let [arr [1 2 3] | |
| new-a (conj arr 4)] | |
| (prn arr) ;; [1 2 3] | |
| ) |
| ;; refs are never mutated | |
| ;; equality is value-based, not identity based | |
| ;; but you can still compare identity | |
| (let [a [1 2 3] | |
| b (conj a 4)] | |
| (prn a) ;; [1 2 3] | |
| (prn b) ;; [1 2 3 4] | |
| (= a b) ;; false | |
| (= a (drop-last b)) ;; true | |
| (identical? a (drop-last b)) ;; false |
| ;; when not every value in transient-states is saved, return a string" | |
| (defn confirm-leave? [db] | |
| (when-not (->> (:transient-states db) | |
| (vals) | |
| (every? :saved?)) | |
| "There is unsaved data, do you want to continue?")) |
| shouldComponentUpdate: function () { | |
| if (this.state.someState) { | |
| // do stuff | |
| } else { | |
| // do different stuff | |
| } | |
| } | |
| , componentDidMount: function() { | |
| if (this.props.someProp && this.state.someOtherState) { | |
| if (!this.props.anotherProp) { |
| // These are the most basic properties required by a line chart. | |
| function Chart() {} | |
| Chart.prototype.data = null; | |
| Chart.prototype.svgWidth = 600; | |
| Chart.prototype.svgHeight = 500; | |
| Chart.prototype.margin = {top: 20.0, right: 20.0, bottom: 20.0, left: 20.0}; | |
| Chart.prototype.width = 500; | |
| Chart.prototype.height = 400; | |
| Chart.prototype.xValue = function (d) { return d[0]; }; | |
| Chart.prototype.yValue = function (d) { return d[1]; }; |