elclanrs
Joined 14 years ago
Joined 14 years ago
Array.apply(null, Array(26)).map((_, index) => String.fromCharCode(65 + index)) [1,2,3].map(unary(User))
[[1,2],[3,4],[5,6]].map(apply(User)) class Maybe {
constructor(value) {
if (value != null) {
return new Just(value)
}
return new Nothing()
}
bind(f) {
if (this instanceof Just) {
return f(this.value)
}
return new Nothing()
}
}
class Just extends Maybe {
constructor(value) {
this.value = value
}
toString() {
return `<Just ${this.value}>`
}
}
class Nothing extends Maybe {
constructor() {
this.value = null
}
toString() {
return '<Nothing>'
}
}
var result = Maybe(2).bind(x => {
return Maybe(3).bind(y => {
return Maybe(x + y)
})
})
console.log(result.toString()) // <Just 5>I have a background in 3D & VFX but my work today is mostly web development, and opensource software covers all my needs. MyPaint for free drawing like brainstorming, illustrations, and blueprints. Inkscape for vector graphics like icons, logos, layouts, mockups. Darktable for simple photo editing. GIMP for heavy photo retouch, and well, it's still my goto tool for those quick screenshots, image cropping jobs. And Blender for 3D work of course. I hardly do print, but when I do I use Inkscape, HTML and CSS.
TLDR; Photoshop isn't the best for every task. There are free software alternatives for everything. Using them all together provides me with all that I need, so I no longer miss Photoshop.
[1] http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf
The beauty of jQuery is working with the DOM as collections. I don't see how it's better to have all these helpers like `nextSibling`, `matches`, or `filter` thrown in the global scope or having to remember is this a real array? jQuery already built solutions for these common problems and exposes a nice API.
If all I need is querying the DOM and I don't have to support IE8 then I may consider using vanilla JavaScript, or building my own simple jQuery-esque library. But you'd start with some structure, and expose your own API. I re-invented the DOM wheel many times, and from my experience, although the code is smaller, I end up going back to jQuery because it covers some edge case or provides something else I need, like AJAX, or nice events, etc.
But building your own DOM library is a good educational challenge. Querying the DOM is all about collections, and if you don't need IE8 then you can use all the ES5 arrays methods, like map and filter. It all boils down to four functions to work with collections: toArray, unique, flatten and query. And four functions to work with the DOM: compose, join, dot, loop. See here for an example http://jsbin.com/EgIkega/1/edit. The article is more about techniques to build your own jQuery-like library; I wouldn't use "el.nextElementSibling || nextElementSibling(el)" when I can use "$(el).next()". C'mon!
Conclusion, you are probably going to use jQuery anyway.
[1] https://docs.npmjs.com/cli/shrinkwrap