Skip to content

Instantly share code, notes, and snippets.

View joystick's full-sized avatar
🧨

Alexei Kozhushkov joystick

🧨
View GitHub Profile
@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
@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
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
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 / 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);
});
});
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 / rx_meteor.js
Created March 24, 2016 11:09 — forked from voxlet/rx_meteor.js
Rx Observable from Meteor reactive source
import Rx from 'rx';
function fromTrackerSource(source) {
return fromAutorun(function(observer) {
try {
observer.onNext(source());
} catch (e) {
observer.onError(e);
}
});
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<link href="https://code.jquery.com/qunit/qunit-git.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/qunit/qunit-git.js"></script>
<script src="http://jashkenas.github.io/underscore/underscore-min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
{
"checks": {
"cron_check": {
"handlers": ["default", "mailer"],
"command": "/etc/sensu/plugins/check-procs.rb -p cron -C 1 ",
"interval": 60,
"subscribers": [ "test" ]
}
}
}
<!DOCTYPE html>
<html>
<head>
<script src="http://documentcloud.github.io/underscore/underscore-min.js"></script>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>