This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const newSet = (idFn, initialValues) => { | |
if (!idFn) { | |
idFn = (x) => x; | |
} | |
const init = initialValues ? | |
initialValues.map((x) => [idFn(x), x]) : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Start", | |
"type": "node", | |
"request": "launch", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = { | |
createSingleLock: createSingleLock, | |
createKeyedLock: createKeyedLock | |
}; | |
// Maintains a list of locks referenced by keys | |
function createKeyedLock() { | |
const locks = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
describe('my-foo-directive', function() { | |
var testDirective; | |
var directive; | |
beforeEach(module('app.test.directive')); | |
beforeEach(module('app.templates')); | |
beforeEach(module('app.components.myFooDirective')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// A drop-in replacement for Set. | |
// Why? | |
// 1) newSet() can be called as a regular function (no need for new) | |
// 2) None of the functions on it use `this`, which means they can be used as higher-order functions | |
function newSet(initialValues) { | |
const s = new Set(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function each(items, fn, concurrency) { | |
if (items.length === 0) { | |
return Promise.resolve(); | |
} | |
return new Promise((resolve, reject) => { | |
let error = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script> | |
</head> | |
<body ng-app="fooApp"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const foo = [{ | |
id: 1, | |
name: 'Mike' | |
}, { | |
id: 2, | |
name: 'Tom' | |
}, { | |
id: 3, | |
name: 'Sally' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = include('request-promise', '3.0.0'); | |
var restify = include('restify', '4.1.0'); | |
var server = restify.createServer({ | |
name: 'myapp', | |
version: '1.0.0' | |
}); | |
server.get('/foo', function (req, res, next) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env cecil | |
// Usage: | |
// ./esclear.js http://your-elasticsearch-host.com | |
var elasticsearch = include('elasticsearch', '^11.0.0'); | |
var index = 'testindex'; | |
var host = process.argv[2]; |