Skip to content

Instantly share code, notes, and snippets.

View webpro's full-sized avatar
👋

Lars Kappert webpro

👋
View GitHub Profile
@webpro
webpro / is-affected.js
Created September 24, 2022 19:53
Using Nx Affected in Azure Pipelines
/*
* This script decides whether containers need to be re-built (and thus re-deployed).
* The result is a special `task.setvariable` printed to the console for affected containers,
* to be picked up by the next build stage in the pipeline.
*
* Usage:
*
* node is-affected.js --pipelineId 1 --app website --app dashboard --app services
*
* Example output:
@webpro
webpro / 1_runner.js
Last active May 26, 2019 19:00
Minimal test runner that covers most of your needs
const util = require('util');
const result = title => err => {
if (err instanceof Error) {
console.log(`✖ ${title}`);
console.error(err.actual || err);
} else {
console.log(`✔ ${title}`);
}
};
@webpro
webpro / bar.js
Last active August 29, 2015 13:59
Source/boilerplate example re. Istanbul "include" FR
/* istanbul include next */
function bar() {
//
}
module.exports = {
bar: bar
}
@webpro
webpro / Gruntfile.js
Last active December 29, 2015 08:38
* Gruntfile.js contains configuration for the `testem` task, but could also be in a `testem.json` file. * If you have Istanbul installed as a local dependency, just replace `istanbul` with `node_modules/istanbul/lib/cli.js`. * The collect-coverage.js is some local server that simply saves any data it receives to `coverage.json`. Within the Teste…
testem: {
coverage: {
options: {
test_page: 'test/index.html#testem,coverage',
parallel: 2,
launch_in_ci: ['PhantomJS'],
on_start: require('./collect-coverage'),
before_tests: 'istanbul instrument src/ --complete-copy --output src_instrumented/',
after_tests: 'istanbul report --root coverage/data/ --dir coverage/report/'
}
@webpro
webpro / gist:7262453
Created November 1, 2013 08:32
Named module in deeper path not resolved
// lib/bar/baz.js
define('bar/baz', [], function() {});
// foo.js
define(['lib/bar/baz'], function(baz) {
// resource requested, but baz = undefined
});
@webpro
webpro / feeds.opml
Last active February 19, 2024 09:46
RSS Feeds (OPML)
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
<head>
<title>My Feeds</title>
</head>
<body>
<outline text="24 ways" htmlUrl="http://24ways.org/" type="rss" xmlUrl="http://feeds.feedburner.com/24ways"/>
<outline text="2ality – JavaScript and more" htmlUrl="http://www.2ality.com/" type="rss" xmlUrl="http://feeds.feedburner.com/2ality"/>
<outline text="456 Berea Street" htmlUrl="http://www.456bereastreet.com/" type="rss" xmlUrl="http://feeds.feedburner.com/456bereastreet"/>
<outline text="@verekia's blog" htmlUrl="http://verekia.com" type="rss" xmlUrl="http://verekia.com/feed"/>
@webpro
webpro / wire-spec.js
Last active December 16, 2015 07:19
define(['wire!otherSpec'], function(otherSpec) {
return {
myModule: {
extends: { $ref: 'otherSpec.myBaseModule' },
args: {
['argOverrides']
}
}
}
});
@webpro
webpro / require-hogan.js
Created September 18, 2012 12:24
RequireJS plugin to compile templates in build process (using r.js)
/**
* RequireJS plugin to compile templates in build process (using r.js).
*
* During development, this delegates the request to the "text" plugin, and compiles the template.
* After build, the template resources are pre-compiled and in-lined in the module that depends on it.
*
* Based on https://github.com/millermedeiros/requirejs-hogan-plugin
*
* Also see http://requirejs.org/docs/plugins.html
*/