Skip to content

Instantly share code, notes, and snippets.

View artemdemo's full-sized avatar
🎯
Focusing

Artem Demo artemdemo

🎯
Focusing
View GitHub Profile
@artemdemo
artemdemo / How to create Node cli executable from npm.md
Created October 10, 2022 06:39 — forked from mritzco/How to create Node cli executable from npm.md
Create Node Package (cli) executable from npm scripts

Creating an executable NPM package and using it

This short guide explains how to create an NPM package that can be called as a script from another project. For clarity: The package to execute will be called: Module The place where you use it: Application

1. Build your module

Create a standard module ignore command line parsing

%reset-Button {
border: none;
margin: 0;
padding: 0;
width: auto;
overflow: visible;
background: transparent;
/* inherit font & color from ancestor */
@artemdemo
artemdemo / Jasmine-and-Babel6.md
Created June 15, 2017 19:14 — forked from mauvm/Jasmine-and-Babel6.md
Jasmine ES6 run script for use with Babel 6
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
 "presets": ["es2015"]
@artemdemo
artemdemo / what-forces-layout.md
Created November 16, 2015 11:35 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@artemdemo
artemdemo / objectToQueryString.js
Last active August 29, 2015 14:19 — forked from dgs700/objectToQueryString.js
Javascript object to URL encoded query string converter. Code extracted from jQuery.param() and boiled down to bare metal js. Should handle deep/nested objects and arrays in the same manner as jQuery's ajax functionality.
var objectToQueryString = function (a) {
var prefix, s, add, name, r20, output;
s = [];
r20 = /%20/g;
add = function (key, value) {
// If value is a function, invoke it and return its value
value = ( typeof value == 'function' ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
if (a instanceof Array) {