Download the image called debian:
docker pull debianThe container in the samples will be named "debby"
| const chain = (obj, op = obj => obj, ...restOps) => restOps.length > 0 | |
| ? chain(op(obj), ...restOps) | |
| : op(obj); |
| [alias] | |
| refresh = !git fetch --all --prune && git checkout master && git pull --rebase && git lastbranch | |
| amend = commit --amend --no-edit | |
| lastbranch = checkout @{-1} | |
| ql = log -10 --oneline --decorate --graph | |
| qb = "!qb(){ git refresh && git checkout -b aei/PPN-$@; }; qb" | |
| qc = "!qc(){ git checkout aei/PPN-$@; }; qc" | |
| qa = "!qa(){ git refresh && git branch --remote | grep $@ | sed 's/origin\\///' | xargs git checkout && git pull --rebase && git rebase master; }; qa" |
| { | |
| "console.log(\"***\", ...)": { | |
| "prefix": "conso", | |
| "scope": "javascript,typescript,typescriptreact", | |
| "body": [ | |
| "console.log(\"*** $1\", $0)", | |
| "" | |
| ] | |
| }, | |
| "debug-map":{ |
| const combinePredicates = (predicate1, predicate2, ...predicateRest) => | |
| (item) => | |
| predicate1(item) && (predicateRest.length > 0? combinePredicates(predicate2, predicateRest[0]): predicate2)(item); | |
| // sample predicates | |
| const exclude = (val) => (item) => item !== val; | |
| const excludeRange = (from, to) => (item) => item < from || item > to; | |
| // sample data | |
| let arr = [1,2,3,4,5,6,7,8,9,10]; |
| function wrapInReadOnlyProxy(orig, throwOnSet = false) { | |
| if (typeof orig !== "object") { | |
| return orig; | |
| } | |
| return new Proxy(orig, { | |
| get: function(target, property) { | |
| if (property in target) { | |
| return wrapInReadOnlyProxy(target[property]); | |
| } |
| // Function to turn node style functions with callbacks into promises. | |
| // This is useful when using async/await, since promises can be awaited upon. | |
| const callback = (resolve, reject) => (err, res) => err ? reject(err) : resolve(res); | |
| const awaitable = async action => new Promise((resolve, reject) => action(callback(resolve, reject))) | |
| module.exports = awaitable; | |
| // Usage: | |
| // const fs = require("fs"); | |
| // const awaitable = require("./awaitable"); |
| { | |
| "version": "0.1.0", | |
| "command": "mocha", | |
| "isShellCommand": true, | |
| "showOutput": "silent", | |
| "args": [ | |
| "--reporter", | |
| "tap", | |
| "--colors" | |
| ], |
| const angular = require("angular"); | |
| const _ = require("lodash"); | |
| angular | |
| .module("modulename") | |
| .directive("componentBinder", function($compile, $parse) { | |
| return { | |
| restrict: "E", | |
| scope: { | |
| componentName: "<", | |
| }, |
| // Returns a new array, with the element at pos replaced with replacement item or calling the replacement function on arr[pos] | |
| function changeAtIndex(arr, pos, replacement) { | |
| if (typeof replacement == "function") { | |
| replacement = replacement(arr[pos]); | |
| } | |
| return [...arr.slice(0, pos), replacement, ...arr.slice(pos + 1)]; | |
| } | |
| // Returns a new array, with the first element matching the predicate function replaced with replacement item or calling the replacement function on arr[pos] |