Skip to content

Instantly share code, notes, and snippets.

View rytmis's full-sized avatar

Lauri Kotilainen rytmis

View GitHub Profile
const Promise = require('bluebird');
const findAsync = (predicate, items) => {
if (items.length < 1) {
return Promise.resolve(undefined);
}
const [current, ...rest] = items;
return predicate(current)
const Promise = require('bluebird');
const reduceAsync = async (projection, initialValue, items) => {
let value = initialValue;
for (const item of items) {
value = await projection(value, item);
}
return value;
}
function Read-Chunk {
param([System.IO.StreamReader] $streamReader, [int] $chunkSize)
$i = 0;
while (($i -lt $chunkSize -and ($line = $streamReader.ReadLine()))) {
$i++;
Write-Output $line
}
}
@rytmis
rytmis / app.html
Created March 7, 2017 13:39
Without inheritBindingContext, refs work
<template>
<require from="./parent-element"></require>
<h1>${message}</h1>
<parent-element />
</template>
@rytmis
rytmis / app.html
Last active March 7, 2017 13:39
Workaround for broken refs: use set-only property
<template>
<require from="./parent-element"></require>
<h1>${message}</h1>
<parent-element />
</template>
@rytmis
rytmis / app.html
Last active February 24, 2019 08:05 — forked from jdanyow/app.html
InheritBindingContext breaks refs
<template>
<require from="./parent-element"></require>
<h1>${message}</h1>
<parent-element />
</template>
2017-02-25 23:43:33, Error DU DU::CDUSession::Search: Failed to set WU internal configuration property for targeted scans. hr = 0x80070057
2017-02-25 23:59:14, Error [0x0803b6] MIG Can't retrieve group information for user NT SERVICE\SQLTELEMETRY. NetUserGetLocalGroups failed 0x000008AD
2017-02-25 23:59:14, Error [0x0803b6] MIG Can't retrieve group information for user NT SERVICE\MSSQLSERVER. NetUserGetLocalGroups failed 0x000008AD
2017-02-25 23:59:14, Error [0x0803b6] MIG Can't retrieve group information for user IIS APPPOOL\Classic .NET AppPool. NetUserGetLocalGroups failed 0x000008AD
2017-02-25 23:59:14, Error [0x0803b6] MIG Can't retrieve group information for user IIS APPPOOL\.NET v4.5. NetUserGetLocalGroups failed 0x000008AD
2017-02-25 23:59:14, Error [0x0803b6] MIG Can't retrieve group information for user IIS APPPOOL\DefaultAppPool. NetUserGetLocalGroups failed 0x000008AD
2017-02-25 23:59:14, Error [0x0803b6] MIG Can't retrieve group
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output cdata-section-elements="message stack-trace"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="assembly">
<test-results>
@rytmis
rytmis / gist:c98925b84ecee561fe82
Last active August 29, 2015 14:17
Custom parameter source for dotless engine
public class DictionaryParameterSource : IParameterSource {
public DictionaryParameterSource(IDictionary<string, string> parameters) {
this.parameters = new Dictionary<string, string>(parameters);
}
public IDictionary<string, string> GetParameters() {
return this.parameters;
}
}
public class SqlAzureClientDriverWithParameterSizeWorkaround : SqlAzureClientDriver {
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType) {
base.InitializeParameter(dbParam, name, sqlType);
if (sqlType.DbType == DbType.StringFixedLength && sqlType.LengthDefined && sqlType.Length == 1) {
dbParam.Size = 1;
}
}
}