Skip to content

Instantly share code, notes, and snippets.

import { Controller, Get } from '@nestjs/common';
@Controller('cats')
export class CatsController {
@Get()
findAll(): string {
return 'This action returns all cats';
}
}
[root] ./weave-zombie-hunter.sh
Unable to find image 'weaveworks/weaveexec:1.5.2' locally
Trying to pull repository registry.access.redhat.com/weaveworks/weaveexec ...
Trying to pull repository docker.io/weaveworks/weaveexec ...
1.5.2: Pulling from docker.io/weaveworks/weaveexec
8f4ec95ceaee: Pulling fs layer
5086797bdfc4: Pulling fs layer
434498369551: Pulling fs layer
8d222e6d5bf7: Pulling fs layer
ea271997bd13: Pulling fs layer
./weave-zombie-hunter.sh
# weave e2:7f:bd:e3:db:d3 @ vethwepl10930: id=8dfc61bc31d8 ip=10.81.128.55/16
# weave e2:7f:bd:e3:db:d3 @ vethwepl10930: missing
# weave 06:fc:01:5e:b5:fa @ vethwepl10930: missing
# weave 02:c5:00:91:95:a4 @ vethwepl10930: id=725dedda4925 ip=10.81.128.108/16
# weave 02:c5:00:91:95:a4 @ vethwepl10930: missing
# weave 02:68:2f:29:fb:27 @ vethwepl10930: missing
# weave 8a:cf:1a:e4:c9:c2 @ vethwepl10930: id=a6e282a7b820 ip=10.81.128.102/16
# weave 8a:cf:1a:e4:c9:c2 @ vethwepl10930: missing
# weave c6:5b:31:a0:77:a1 @ vethwepl10930: missing
@panuhorsmalahti
panuhorsmalahti / polymer-script-type.html
Created May 13, 2016 16:51
Polymer script type example
<link rel="import" href="../polymer/polymer.html">
<dom-module id="hello-world">
<template>
<h1>Hello</h1>
</template>
</dom-module>
<script type="module">
import { assign } from "./lib/lodash/lodash.js";
@panuhorsmalahti
panuhorsmalahti / constraints.js
Created March 2, 2016 17:33
Clojure-style :pre and :post constraints in ES6 - big thanks to @polytypic for the original idea!
// copied from https://gist.github.com/lauripiispanen/1fd1c3319084f9913f2d
// improved formatting
const constrain = ({
pre = () => {},
post = () => {}
}) => fn => (...args) => {
const throwIf = x => y => {
if (x(y)) {
throw x(y);
} else {
@panuhorsmalahti
panuhorsmalahti / serialize.js
Last active December 4, 2015 15:58
Serialize references
function randomID() {
return Math.random();
}
function serialize(obj, store) {
const retVal = {};
store = store || {
root: retVal,
objects: {},
@panuhorsmalahti
panuhorsmalahti / memleak-test.js
Created August 21, 2015 15:47
memleak-test.js
function f(p) {
console.log(Date.now());
var x = [];
while(x.length < 1000000) x.push(x.length);
p = p || {};
setTimeout(function() {
f(p);
}, 25);
};
@panuhorsmalahti
panuhorsmalahti / changed.js
Last active August 29, 2015 14:25
Call a function if the parameters differ
// Calls 'f' if the parameters are different from the last call.
// NOTE: Implement 'notEqual' yourself
const changed = f => {
let lastParams = undefined, flag = false;
return (...args) => {
if (!flag || notEqual(lastParams, args)) {
f(args);
lastParams = args;
flag = true
}
@panuhorsmalahti
panuhorsmalahti / getter-shorthand.js
Created June 11, 2015 17:23
ES6 proxy property getter shorthand
const _ = new Proxy({}, { get: (target, prop) => it => it[prop] });
// Evaluates to [{ foo: true }]
[{ foo: true }, { foo: false }].filter(_.foo);
@panuhorsmalahti
panuhorsmalahti / updated_removed.js
Last active August 29, 2015 14:21
updated() and removed()
const updated = (source, property, value) => {
const out = {};
Object.keys(source).forEach(key => {
out[key] = source[key];
});
out[property] = value;
return out;
};
const removed = (source, property) => {