17 private links
mics (pronounce: mix) is a library that makes multiple inheritance in Javascript a breeze. Inspired by the excellent blog post “Real” Mixins with Javascript Classes by Justin Fagnani, mics tries to build a minimal library around the concept of using class expressions (factories) as mixins. mics extends the concepts presented in the blog post by making the mixins first-class citizens that can be directly used to instantiate objects and can be mixed in with other mixins instead of just with classes.
The truth is, ternaries are usually much simpler than if statements. People believe the reverse for two reasons:
- They’re more familiar with if statements. Familiarity bias can lead us to believe things that aren’t true, even when we’re presented with evidence to the contrary.
- People try to use ternary statements as if they’re if statements. That doesn’t work, because ternary expressions are expressions, not statements.
Before we get into the details, let’s define a ternary expression:
A ternary expression is a conditional expression that evaluates to a value. It consists of a conditional, a truthy clause (the value to produce if the conditional evaluates to a truthy value), and a falsy clause (the value to produce if the conditional evaluates to a falsy value).
npm install -g
won't finish installs on WSL Ubuntu. What I did to fix this issue:
- turned of any application running on port 3000
- cleaned npm cache
- some said I should remove package.json.lock, but what about Yarn?
Extension for Visual Studio Code - Sublime Text's babel-sublime grammar in VS Code.
npm install legally -g # Make it work everywhere
legally # Check licenses of current directory
legally express # Check an npm library's licenses
One of the biggest obstacles for adoption of Angular in the enterprise is technical, but not of the nature that one could expect.
It's hard to convince our boss to use Angular in our next project if we can't even install it in our own PC ;-) ! We would probably want to do an early demo or prototype to get things started.
But many companies have corporate proxies and security policies that make tools like npm hard to try out for the first time.
One of the biggest features of AngularJs is that it does not come necessarily with all the tooling ecosystem, and can be used via simple script tags. Angular 2 and beyond in principle can also, but we really want to use it together with Typescript, the Angular CLI, Webpack and all the tooling ecosystem.
The (many) reasons why you could not have JS.
How much library code do you really need — 50K? 100K? 150K? More? How much of that do you really use?
Sure, we all love our favorite monolithic frameworks, and sometimes we even use them fully. But how often do we reach for the ride-on John Deere tractor with air conditioning and six-speaker sound system, when a judiciously applied pocketknife would do the trick better, faster, slicker?
Micro-frameworks are definitely the pocketknives of the JavaScript library world: short, sweet, to the point. And at 5k and under, micro-frameworks are very very portable. A micro-framework does one thing and one thing only — and does it well. No cruft, no featuritis, no feature creep, no excess anywhere.
Microjs.com helps you discover the most compact-but-powerful microframeworks, and makes it easy for you to pick one that’ll work for you.
Flatris is a mobile-friendly implementation of Tetris, built using React & Redux.
Use the arrow keys or buttons below to play.
The game state is preserved between visits, so you can safely kill this tab when your employer is approaching and resume afterwards–including offline!
Check out the source code when you're done playing.
Built by @skidding.
Closer to the Metal
Preact provides the thinnest possible Virtual DOM abstraction on top of the DOM. The web is a stable platform, it's time we stopped reimplementing it in the name of safety.
Preact is also a first-class citizen of the web platform. It diffs Virtual DOM against the DOM itself, registers real event handlers, and plays nicely with other libraries.
Small Size
Most UI frameworks are large enough to be the majority of an app's JavaScript size. Preact is different: it's small enough that your code is the largest part of your application.
That means less JavaScript to download, parse and execute - leaving more time for your code, so you can build an experience you define without fighting to keep a framework under control.
Big Performance
Preact is fast, and not just because of its size. It's one of the fastest Virtual DOM libraries out there, thanks to a simple and predictable diff implementation.
It even includes extra performance features like customizable update batching, optional async rendering, DOM recycling, and optimized event handling via Linked State.
Portable & Embeddable
Preact's tiny footprint means you can take the powerful Virtual DOM Component paradigm to new places it couldn't otherwise go.
Use Preact to build parts of an app without complex integration. Embed Preact into a widget and apply the same tools and techniques that you would to build a full app.
Instantly Productive
Lightweight is a lot more fun when you don't have to sacrifice productivity to get there. Preact gets you productive right away. It even has a few bonus features:
- props, state and context are passed to render()
- Use standard HTML attributes like class and for
- Works with React DevTools right out of the box
Ecosystem Compatible
Virtual DOM Components make it easy to share reusable things - everything from buttons to data providers. Preact's design means you can seamlessly use thousands of Components available in the React ecosystem.
Adding a simple preact-compat alias to your bundler provides a compatibility layer that enables even the most complex React components to be used in your application.
The built-in js-mode in Emacs does not provide many features for working with js framework beside js editing and syntax highlighting. The tips in this post will help you transform your Emacs into a powerful Javascript IDE.
A free, once–weekly e-mail round-up of JavaScript news and articles.
Middleware is a function that receives the request and response objects of an HTTP request/response cycle. It may modify (transform) these objects before passing them to the next middleware function in the chain. It may decide to write to the response; it may also end the response without continuing the chain.
In other frameworks “middleware” is called “filters”, but the concept is the same: a request, response, and some transformation functions.
No JavaScript frameworks were created during the writing of this article.
The following is inspired by the article “It’s the future” from Circle CI. You can read the original here. This piece is just an opinion, and like any JavaScript framework, it shouldn’t be taken too seriously.
The ecosystem of JavaScript has grown. Long gone are the days of simply inserting jQuery into your website and fading stuff in or out.
Entering the world of JavaScript today is an overwhelming task with lots of possibilities. It also means that it’s a world that’s brimming with opportunity. In the words of Jeff Atwood (http://blog.codinghorror.com/the-principle-of-least-power/):
Any application that can be written in JavaScript, will eventually be written in JavaScript.
Gulp est un "Automatiseur de tâches", un task runner comme disent nos amis anglophones, c'est à dire qu'il est capable de lancer des bouts de scripts à votre place tout seul comme un grand.
Ces tâches dépendent de votre bon vouloir et peuvent être très variées :
- des opérations simples telles que minifier ou concaténer du CSS ou du JavaScript,
- la création ou la suppression de dossiers ou de fichiers (possibilité de créer un projet à partir de zéro),
- l'optimisation, la compression d'images,
- la création de serveur local permettant de tester sur de multiples périphériques en même temps,
- la simulation de navigateurs fantômes conçus pour parcourir et tester les regressions d'affichage d'une page,
- etc.