Skip to content

Instantly share code, notes, and snippets.

View abezhinaru's full-sized avatar
🎯

Andrii Bezhinaru abezhinaru

🎯
  • Lohika
  • Odessa, Ukraine
View GitHub Profile
/**
* Remove item from array by index
*
* @param {object[]} arr
* @param {number} index
*
* @returns {*[]}
*/
export const removeByIndex = (arr, index) => ([
...arr.slice(0, index),
SELECT
'DROP' || ' ' || object_type || ' ' || object_name || ' ' || CASE(object_type)
WHEN 'TABLE' THEN 'CASCADE CONSTRAINTS;'
ELSE ';'
END
FROM user_objects
WHERE
object_type IN ('TABLE','VIEW','PACKAGE','PROCEDURE','FUNCTION','SEQUENCE');
/**
* Function that separates a string value to line by symbols length;
*
* @param {String} string - input string
* @param {Number} lineLength - symbols length per line
* @param {Boolean} useSpaces - Take into account the gaps or not
* @returns {Array.<String>}
*/
const lineSplitter = (string, lineLength, useSpaces = true) => {
let result = [];
/**
*
* Creating configurable property
*
* @param {Object} obj - Object to which should be assigned a new property
*
* @param {String} name - property name
* @param {object} descriptor - property settings
* @param {Function} descriptor.get - fn fires when receive prop value
// Which HTML element is the target of the event
const mouseTarget = (e) => {
let targ;
e = !e ? window.event : e;
if (e.target) {
targ = e.target;
} else if (e.srcElement) {
targ = e.srcElement;
const debounce = (func, waitTime) => {
let startTime;
let timeoutId;
let isWorking = () => {
return timeoutId && startTime + waitTime > Date.now();
}
return () => {
if (isWorking()) {
window.test = tape;
// Concatenative inheritance example;
var Animal = {
animalName: 'animal',
describe: function() {
return 'This is an ' + this.animalName + '. ';
}
};