touch ~/.zsh_functions
vim ~/.zsh_functions
function jcurl() {
curl -s "$@" | json | pygmentize -l json
}
function tojson(){
touch ~/.zsh_functions
vim ~/.zsh_functions
function jcurl() {
curl -s "$@" | json | pygmentize -l json
}
function tojson(){
For my use cases, Vue has one critical pitfall: I frequently have/want to use Vue components with <slot>
s as wrappers for content from a CMS which I don't have control over. That is, the content comes over the wire via HTML, and I have to activate Vue for some of it.
<interactive-element> <p>Slot content I don't have control over</p> </interactive-element>I need to activate the Vue component
<interactive-element>
.
This is about how to split a GitHub pull request, following a real in-the-wild example.
So it happened that I once wanted to fix a bug (#832) on the shelljs
repository.
I forked the repository, cloned it and created a new branch called ln-directory-dest
. I fixed the bug, created a pull request, and implemented initial review feedback.
At this point, I had added the commits A, B, C, D, E and [F](https://github.com/Loilo/shelljs/commit/946ab48bf5cf9c8aac03407
function magicMethods (clazz) { | |
// A toggle switch for the __isset method | |
// Needed to control "prop in instance" inside of getters | |
let issetEnabled = true | |
const classHandler = Object.create(null) | |
// Trap for class instantiation | |
classHandler.construct = (target, args) => { | |
// Wrapped class instance |
Vue events don't bubble the component tree themselves. However when writing wrapper components this can be the desired behaviour.
This code registers a global bubble
directive which allows to re-emit all given events:
Let's say we want to bubble events start
, accelerate
and brake
of our component Car
.
Without any help, we'd roughly have to do this:
// Arbitrarily nested object containing Promises goes in | |
// Plain data structure comes out | |
async function deepAsync (object) { | |
// Walk arrays | |
if (Array.isArray(object)) { | |
return Promise.all(object.map(async item => await deepAsync(item))) | |
// Walk objects | |
} else if (object instanceof Object) { | |
return Object |
This is a small Rangeslider library. It's probably not production ready yet (i.e. not been tested in a production project), therefore it's just a Gist and not a fully-blown GitHub repo.
I created this because no existing library met all my criteria:
// A very basic web server in node.js | |
// Stolen from: Node.js for Front-End Developers by Garann Means (p. 9-10) | |
var port = 8000; | |
var serverUrl = "127.0.0.1"; | |
var http = require("http"); | |
var path = require("path"); | |
var fs = require("fs"); | |
var checkMimeType = true; |