Skip to content

Instantly share code, notes, and snippets.

View kohlikohl's full-sized avatar

Matthias Knoll kohlikohl

View GitHub Profile
@kohlikohl
kohlikohl / script.js
Last active September 27, 2023 08:41
Fix VSTS code coverage reporting by inlining CSS
let fs = require("fs-jetpack"),
path = require("path"),
inline = require("inline-css");
// This inlines the css of the HTML coverage output as VSTS
// strips all external CSS files
const CODE_COVERAGE_DIRECTORY = "./coverage";
const files = fs.find(CODE_COVERAGE_DIRECTORY, { matching: "*.html" });
var win = window;
a();
function a(exports) {
console.log('Loading');
exports = win;
console.log('exports',exports);
//
// Array utilities
//
@kohlikohl
kohlikohl / index.js
Last active November 9, 2016 02:06
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var ko = require('knockout'),
knockoutSecureBinding = require('knockout-secure-binding');
var options = {
attribute: "data-bind", // default "data-sbind"
globals: window, // default {}
bindings: ko.bindingHandlers, // default ko.bindingHandlers
@kohlikohl
kohlikohl / Challenge.md
Last active December 17, 2015 06:58
Coding Challenge 4

Coding Challenge 4

This weeks challenge is to write a so called "Pattern Chaser".

Instructions

Language

JavaScript

Expose a function called bnt.patternChaser(str) to the global namespace which takes one string as a parameter and returns "yes [found pattern]" or "no null".

@kohlikohl
kohlikohl / mysql.js
Created March 28, 2013 09:54
Improvement?
var Mysql = module.exports = function (conf) {
var poolConfig = {
name: 'mysql',
create: this._createConnection.bind(this),
destroy: this._destroyConnection,
max: 10
};
this._conf = conf;
this._pool = pool.Pool(poolConfig);
@kohlikohl
kohlikohl / sendGrid.js
Created March 27, 2013 17:52
Multiple methodes
SendGridClient.prototype.send = function (message, parameters) {
var deferred = when.defer();
when(parameters,
this._sendEmail.bind(this, deferred, message),
function (error) {
deferred.reject(error);
}
);
SendGridClient.prototype.send = function (message, parameters) {
var deferred = when.defer(),
guid = this.guidGen(),
sendGrid = this._sendGrid;
when(parameters,
function (parameters) {
var email = new SendGridEmail(parameters);
if (message.get("categories")) {