Skip to content

Instantly share code, notes, and snippets.

View made-by-chris's full-sized avatar
🏁

Christopher Shelley made-by-chris

🏁
View GitHub Profile
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.
$ = 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
@made-by-chris
made-by-chris / fm.js
Last active December 5, 2016 04:37
fm - minimal observer with model
const fm = (() => {
let model = {}
let observers = { fm_observe_all: [] }
return {
save: (key, val) => {
model[key] = val
emit(key)
},
silentSave: (key, val) => {
model[key] = val
$ = 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 = ''
$ = 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(){
$ = function(parameters) {
console.log(parameters)
return {
left: function(){
console.log(parameters, "turning left")
return this
},
right: function(){
console.log(parameters, "turning right")
return this
$(".my-list li").left().right()
// logs "Uncaught TypeError: $ is not a function"
$ = {
left: function() {
console.log("turning left")
return this
},
right: function() {
console.log("turning right")
return this
}
}
$.left().right()
// logs "Uncaught TypeError: Cannot read property 'right' of undefined"
@made-by-chris
made-by-chris / 1.js
Created December 2, 2016 06:55
An object with methods.
$ = {
left: function() {
console.log("turning left")
},
right: function() {
console.log("turning right")
}
}
$.left()
// logs "turning left"