This file contains 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
/** | |
* Remove item from array by index | |
* | |
* @param {object[]} arr | |
* @param {number} index | |
* | |
* @returns {*[]} | |
*/ | |
export const removeByIndex = (arr, index) => ([ | |
...arr.slice(0, index), |
This file contains 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
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'); |
This file contains 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
/** | |
* 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 = []; |
This file contains 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
/** | |
* | |
* 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 |
This file contains 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
// 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; |
This file contains 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 debounce = (func, waitTime) => { | |
let startTime; | |
let timeoutId; | |
let isWorking = () => { | |
return timeoutId && startTime + waitTime > Date.now(); | |
} | |
return () => { | |
if (isWorking()) { |
This file contains 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
window.test = tape; | |
// Concatenative inheritance example; | |
var Animal = { | |
animalName: 'animal', | |
describe: function() { | |
return 'This is an ' + this.animalName + '. '; | |
} | |
}; |