Skip to content

Instantly share code, notes, and snippets.

Angel Grablev agrublev

Block or report user

Report or block agrublev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View asdsad.md

(fix) [teas] sad - 2016-09-07

5343}

Updated:


package bump type
"@f/fkit" patch
View HOC-decorator.js
/* eslint eqeqeq: 0 */
import React from 'react';
function computeHeight(node) {
const totalHeight = parseInt(getComputedStyle(node).height, 10);
const padding =
parseInt(getComputedStyle(node).paddingTop, 10) +
parseInt(getComputedStyle(node).paddingBottom, 10);
return totalHeight - padding;
}
@agrublev
agrublev / recursiveFileList.js
Created Oct 29, 2019
Node Recursive File List
View recursiveFileList.js
const fs = require("fs");
const path = require("path");
const walk = function(dir, done) {
let results = [];
fs.readdir(dir, function(err, list) {
if (err) return done(err);
let pending = list.length;
if (!pending) return done(null, results);
list.forEach(function(file) {
View mergeObjectsNicely
const isObject = obj => obj === Object(obj);
const merge = (obj1, obj2) => {
Object.keys(obj1).forEach(key => {
if (Array.isArray(obj1[key])) {
if (obj2[key]) obj1[key] = [...obj1[key], ...obj2[key]];
} else if (isObject(obj1[key])) {
if (obj2[key]) obj1[key] = { ...obj1[key], ...obj2[key] };
} else {
if (obj2[key] !== undefined) {
@agrublev
agrublev / genFileDateName.js
Last active Oct 22, 2019
Generate filename with date
View genFileDateName.js
/**
* Return a timestamp with the format "m-d-yy"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
let now = new Date();
// Create an array with the current month, day and time
View as.js
const arr1 = [1, 2, 3, 4, 5];
if (arr1.indexOf(1) !== -1) {
console.log("Arr1 HAS the integer 1!");
}
if (arr1.includes(1)) {
console.log("Arr1 HAS the integer 1!");
}
@agrublev
agrublev / cleanall.sh
Created Jun 4, 2019
Clean all node modules
View cleanall.sh
find . -name "node_modules" -exec rm -rf '{}' +
@agrublev
agrublev / RECURS_OBJECTS.js
Last active Apr 23, 2019
Recursive object manipulation
View RECURS_OBJECTS.js
const iterateObject = (obj, executeOnValue) => {
Object.keys(obj).forEach(name=> {
let val = obj[name];
if (typeof val === "object") {
return iterateObject(val, executeOnValue);
} else if (val === undefined) {
obj[name] = "";
} else {
obj[name] = executeOnValue(val);
}
View blueprint
import "@blueprintjs/icons/lib/css/blueprint-icons.css";
import "@blueprintjs/core/lib/css/blueprint.css";
You can’t perform that action at this time.