Skip to content

Instantly share code, notes, and snippets.

@avishnyak
avishnyak / give-when-then.md
Created September 1, 2021 22:22
Test Case Template

Scenario: ... what behavior will be tested ... Given ... conditions ... When ... actions ... Then ... expected results ...

Actions:

  1. item
  2. item
  3. item
@avishnyak
avishnyak / convert.js
Created May 25, 2020 04:46
Convert vscode theme obj to CSS variables
console.log(Object.entries({
"foreground":"#36373B",
"focusBorder":"#161F26",
"widget.shadow":"#161F2694",
"input.background":"#FFF",
"input.border":"#161F26",
"input.foreground":"#000",
"input.placeholderForeground":"#a0a0a0",
"inputOption.activeBorder":"#3E313C",
"inputValidation.errorBackground":"#F44C5E",
@avishnyak
avishnyak / example.js
Created June 1, 2016 16:06
Multicast-Manager
var net_manager = require('./net_manager');
net_manager.withSocket(function (api) {
return api.broadcast('This is a test')
.then(api.unbind);
});
@avishnyak
avishnyak / Studiojs-Version-Proposal.md
Last active May 23, 2016 17:50
Studiojs Service Version Proposal

Versioning is implemented as a plugin that users can opt into so that there is a simple on-ramp without a bunch of boilerplate.

A user would start with the simplest possible code for a service.

Studio(function serviceA() {
  return Math.random();
});

Sometime in the future, a user decides that they want to change a version of the service but leaves the old instance in tact until they can modify all the rest of their services.

@avishnyak
avishnyak / Angular Drill-down Selector.markdown
Created December 16, 2015 07:25
Angular Drill-down Selector

Angular Drill-down Selector

Drill down with folders and selectable items in Angular.

Includes: Dynamic drill-down, select-all functionality, and breadcrumbs.

A Pen by Anton Vishnyak on CodePen.

License.

// Minimal middleware implementation
// Works in node and the browser
// Inspired by https://github.com/h2non/midware
// Usage examples are at the bottom...
function middleware(ctx) {
let calls = [];
let errorHandlers = [];
var ctx = ctx || null;