This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set up emacs with clojure bindings and REPL here > http://www.braveclojure.com/basic-emacs/ | |
*Navigation* | |
Keys Description | |
C-a Move to beginning of line. | |
M-m Move to first non-whitespace character on the line. | |
C-e Move to end of line. | |
C-f Move forward one character. | |
C-b Move backward one character. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = function(parameters) { | |
this.state = {}; | |
this.state.nodeList = document.querySelectorAll(parameters) | |
this.state.dom = [].slice.call(state.nodeList) | |
return this instanceof $ ? this : new $(parameters) | |
} | |
$.prototype = { | |
left: function(){ | |
console.log(this.state.dom.length, "turning left") | |
return this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fm = (() => { | |
let model = {} | |
let observers = { fm_observe_all: [] } | |
return { | |
save: (key, val) => { | |
model[key] = val | |
emit(key) | |
}, | |
silentSave: (key, val) => { | |
model[key] = val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = function(domSelector) { | |
this.state = {}; | |
this.state.nodeList = document.querySelectorAll(domSelector) | |
this.state.dom = [].slice.call(state.nodeList) | |
return this instanceof $ ? this : new $(domSelector) | |
} | |
$.prototype = { | |
show : function() { | |
this.state.dom.forEach(function(node) { | |
node.style.display = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = function(parameters) { | |
var state = {} | |
state.nodeList = document.querySelectorAll(parameters) | |
state.dom = [].slice.call(state.nodeList) | |
return { | |
left: function(){ | |
console.log(state.dom, “turning left”) | |
return this | |
}, | |
right: function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = function(parameters) { | |
console.log(parameters) | |
return { | |
left: function(){ | |
console.log(parameters, "turning left") | |
return this | |
}, | |
right: function(){ | |
console.log(parameters, "turning right") | |
return this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".my-list li").left().right() | |
// logs "Uncaught TypeError: $ is not a function" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = { | |
left: function() { | |
console.log("turning left") | |
return this | |
}, | |
right: function() { | |
console.log("turning right") | |
return this | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.left().right() | |
// logs "Uncaught TypeError: Cannot read property 'right' of undefined" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = { | |
left: function() { | |
console.log("turning left") | |
}, | |
right: function() { | |
console.log("turning right") | |
} | |
} | |
$.left() | |
// logs "turning left" |