Skip to content

Instantly share code, notes, and snippets.

View NaridaL's full-sized avatar

Adrian Leonhard NaridaL

  • Microsoft
  • Dublin, Ireland
View GitHub Profile
@NaridaL
NaridaL / aligning-images.md
Last active September 18, 2018 18:26 — forked from DavidWells/aligning-images.md
Guide to aligning images in github readme.md files

Aligning images

s tag sub tag

details tag
s tag ## `left` alignment

This file has been truncated, but you can view the full file.
(function(l, i, v, e) { v = l.createElement(i); v.async = 1; v.src = '//' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; e = l.getElementsByTagName(i)[0]; e.parentNode.insertBefore(v, e)})(document, 'script');
var viewer = (function (exports,svgPathdata) {
'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
var path = require('path');
var webpack = require('webpack');
console.log(path.join(__dirname, 'node_modules/brepts/dist/bundle.js'))
module.exports = {
devtool: 'eval-source-map',
entry: [
'webpack-dev-server/client?http://localhost:2000',
'./src/index'
],
output: {
import fs = require('fs');
import ts = require('typescript');
// Create the language service host to allow the LS to communicate with the host
const servicesHost: ts.LanguageServiceHost = {
getScriptFileNames: () => rootFileNames,
getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(),
getScriptSnapshot: (fileName) => {
if (!fs.existsSync(fileName)) {
return undefined;
// Type definitions for Electron 9.9.9
// Project: http://electron.atom.io/
// Definitions by: The Electron Team <https://github.com/electron/electron>
// Definitions: https://github.com/electron/electron-typescript-definitions
/// <reference types="node" />
type GlobalEvent = Event;
/** @deprecated */
declare module 'r-script' {
interface R {
data(...args: any[]): this
call(callback: (err: any, d: any) => void): void
call(options: R.Options, callback: (err: any, d: any) => void): void
callSync(options: R.Options): any
}
namespace R {
interface Options {
dataframe?: 'rows' | 'colums' | 'values'
@NaridaL
NaridaL / tsfaq.md
Last active November 9, 2017 19:25

Pseudo-Variadic arguments aka How do I change the return type of a function?

Until microsoft/TypeScript#5453 is implemented, you'll need to create multiple overloads, one for each number of arguments. For example, this is the type definition of a function which takes a function and returns a function with the same arguments but the result wrapped in a Promise.

declare function wrapPromise<R>(f: () => R): () => Promise<R> 
declare function wrapPromise<A1, R>(f: (a1: A1) => R): (a1: A1) => Promise<R>
declare function wrapPromise<A1, A2, R>(f: (a1: A1, a2: A2) => R): (a1: A1, a2: A2) => Promise<R>
declare function wrapPromise<A1, A2, A3, R>(f: (a1: A1, a2: A2, a3: A3) => R): (a1: A1, a2: A2, a3: A3) => Promise<R>
declare function wrapPromise<A1, A2, A3, A4, R>(f: (a1: A1, a2: A2, a3: A3, a4: A4) => R): (a1: A1, a2: A2, a3: A3, a4: A4) => Promise<R>
// etc. 8 arguments should be enough for everyone :-P
// see also https://www.npmjs.com/package/subtractiontype.ts
// for literal unions
type Sub0<
O extends string,
D extends string,
> = {[K in O]: (Record<D, never> & Record<string, K>)[K]}
type Sub<
///<reference path="NLA.ts"/>
///<reference path="NLA.ts"/>
/**
* Java style map.
*/
class CustomMap<K extends { hashCode(): int, equals(x: any): boolean, hashCodes?(): int[], like(x: any): boolean }, V> implements Map<K, V> {
[Symbol.toStringTag]: 'Map' = 'Map'
toString() {
///<reference path="NLA.ts"/>
class CustomSet<T extends Equalable> implements Set<T> {
[Symbol.toStringTag]:'Set' = 'Set'
forEach(callbackfn: (value: T, index: T, set: Set<T>)=>void, thisArg?: any): void {
for (const value of this.entries()) {
callbackfn.call(thisArg, value, value, this)