Skip to content

Instantly share code, notes, and snippets.

View wmakeev's full-sized avatar
💭
💻

Makeev Vitaliy wmakeev

💭
💻
View GitHub Profile
@wmakeev
wmakeev / dmd.js
Last active June 11, 2016 07:40
Distributed module declaration
// 1. Module declaration
{
name: 'myModule',
version: '2.1.0',
description: 'Example module',
connectors: {
'customer': {
'createInvoice': {
$meta: {
type: 'handler', // handler | multicast | unicast
@wmakeev
wmakeev / case-01-tap.js
Last active July 22, 2016 12:34
TAP tests environments
// Run all node-tap test in __test__ dirs from ./src root
// test/index.js
let tap = require('tap')
let reporter = require('tap-mocha-reporter')
let walk = require('walkdir')
let testFilePattern = /__tests__[\/\\]+.+-test\.js$/i
@wmakeev
wmakeev / .editorconfig
Last active January 7, 2018 13:55
Node.js project environment bootstrap #env #config #eslint
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@wmakeev
wmakeev / scripts-01.js
Created June 26, 2016 10:14
NPM build scripts examples
// from https://github.com/stoeffel/compose-function/blob/master/package.json
"scripts": {
"clean": "git reset && echo '/node_modules/' > .gitignore && git add .gitignore && git stash save --include-untracked --keep-index '`npm run clean` trash can' && git clean --force -d && git reset --hard && echo '\nclean: Uncommitted and ignored files have been moved to gitâ™s stash. To restore them run `git stash pop --quiet; git checkout .gitignore`.'",
"coverage": "rm -rf coverage && npm run test:transpile && cd .es5 && istanbul cover test.js && mv coverage ..",
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
"develop": "nodangel --ignore node_modules --ignore coverage --exec 'npm run --silent test:lite'",
"prepublish": "npm run --silent clean && npm run transpile",
"patch-release": "npm version patch && npm publish && git push --follow-tags",
"minor-release": "npm version minor && npm publish && git push --follow-tags",
"major-release": "npm version major && npm publish && git
@wmakeev
wmakeev / s3-upload.js
Last active February 6, 2017 16:17
AWS S3 #aws
/**
* index
* Date: 12.09.14
* Vitaliy V. Makeev ([email protected])
*/
var _ = require('lodash')
, AWS = require('aws-sdk')
, path = require('path')
, url = require('url');
@wmakeev
wmakeev / global-instal.sh
Created June 29, 2016 09:00
JS Standard
sudo npm install \
eslint standard standard-format eslint-config-standard \
eslint-plugin-standard eslint-plugin-promise -g
@wmakeev
wmakeev / get-it.js
Last active July 5, 2016 15:39
lodash.get wrapper #tools
let get = require('lodash.get')
const getIt = function (...args) {
return action => {
let value = get.apply(this, args)
if (action && value !== void 0) {
return action(value)
} else {
return value
}
@wmakeev
wmakeev / receive.js
Last active July 14, 2016 14:37
AWS SQS #aws #sqs
(function () {
'use strict'
AWS.config.update({
accessKeyId: 'accessKeyId',
secretAccessKey: 'secretAccessKey'
})
AWS.config.region = 'eu-west-1'
@wmakeev
wmakeev / diff-patch.js
Created August 12, 2016 08:50
JSON diff #json #diff
'use strict'
const jsondiffpatch = require('jsondiffpatch')
const stringify = require('json-stable-stringify')
const objectHashFunctions = [
obj => obj.uuid,
obj => obj.id,
obj => stringify(obj)
]
@wmakeev
wmakeev / EnvironmentVariables.md
Last active August 19, 2016 13:16
AWS #aws #s3 #cli

The following variables are supported by the AWS CLI

AWS_ACCESS_KEY_ID – AWS access key.

AWS_SECRET_ACCESS_KEY – AWS secret key. Access and secret key variables override credentials stored in credential and config files.

AWS_SESSION_TOKEN – session token. A session token is only required if you are using temporary security credentials.