Skip to content

Instantly share code, notes, and snippets.

View joystick's full-sized avatar
🧨

Alexei Kozhushkov joystick

🧨
View GitHub Profile
var sql = require('seriate');
var _ = require('underscore');
var sqlconf = require('./sqlconf');
sql.setDefaultConfig(sqlconf);
var countAccounts = function(cocd) {
return sql.execute({
query: "select count(*) as count from [dbo].[accaccounts] where [account_comp] = @cocd",
params: {
@joystick
joystick / mapSequence.js
Created November 17, 2017 10:38
Executing Promises Sequentially
module.exports = function mapSequence(arr, func) {
return new Promise(function(resolve) {
var res = [];
var sequence = Promise.resolve();
arr.forEach(function(t) {
sequence = sequence.then(function() {
return func(t).then(function(data) {
return res.push(data);
});
});
@joystick
joystick / machine.js
Last active July 1, 2020 07:45
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@joystick
joystick / machine.js
Last active August 15, 2020 13:08
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@joystick
joystick / machine.js
Created April 24, 2021 18:05
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@joystick
joystick / machine.js
Created April 29, 2021 08:31
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions