Skip to content

Instantly share code, notes, and snippets.

@spicemix
spicemix / setOps.md
Last active April 26, 2016 06:20 — forked from jabney/setOps.js
Fast TypeScript set operations: union, intersection, difference, complement, and equals. Includes support for objects.

setOps.ts

Set operations in setOps.ts take two arrays and return the result of the operation as an array. Supported operations are union, intersection, difference, complement, and equals. difference is the symmetric difference and complement is the relative complement. The set operations are fast, even for large arrays.

This code is provided as a gist for ease of use; simply add it to your project as if it was one of your own files and import what you need from it.

There are different ways to apply these operations in TypeScript. A set of static convenience functions is supplied for simple cases along with an ISetOps interface and a SetOps class.

Simple Usage

@spicemix
spicemix / jasmine-dark-theme.css
Created April 26, 2016 05:37
Jasmine dark theme CSS (e.g. to match Chrome developer tools dark theme)
body { overflow-y: scroll; background-color: #252525;}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track-piece { background-color: transparent; -webkit-border-radius: 6px; border-radius: 6px; }
.jasmine_html-reporter { background-color: #252525; padding: 5px; margin: -8px; font-size: 11px; font-family: Consolas, Menlo, monospace; line-height: 14px; color: #fff; }
.jasmine_html-reporter a { text-decoration: none; }
.jasmine_html-reporter a:hover { text-decoration: underline; }
.jasmine_html-reporter p, .jasmine_html-reporter h1, .jasmine_html-reporter h2, .jasmine_html-reporter h3, .jasmine_html-reporter h4, .jasmine_html-reporter h5, .jasmine_html-reporter h6 { margin: 0; line-height: 14px; }
.jasmine_html-reporter .jasmine-banner, .jasmine_html-reporter .jasmine-symbol-summary, .jasmine_html-reporter .jasmine-summary, .jasmine_html-reporter .jasmine-result-message, .jasmine_html-reporter .jasmine-spec .jasmine-description, .jasmine_html-reporter .jasmine-spec-detail .jasmine-description, .jasmi