Skip to content

Instantly share code, notes, and snippets.

@luislobo14rap
luislobo14rap / arrayToPlain.js
Last active December 8, 2019 05:49
setArray.js
// arrayToPlain.js v1
function arrayToPlain(array_, columns = 2, heading){
// clone array
array__ = array_.join('!@#$%$#@!').split('!@#$%$#@!');
if(heading){
array__ = [...heading, ...array__];
};
let csv = [];
let column = 0;
let tempArray = [];
@luislobo14rap
luislobo14rap / sort-obj-by.js
Last active June 19, 2024 08:29
sort-obj-by.js
// sort-obj-by.js v1
function sortObjBy(array, property) {
return array.sort(function(a, b) {
return a[property] > b[property] ? 1 : -1
});
};
Object.prototype.sortObjBy = function(property) {
return sortObjBy(this, property);
};
@luislobo14rap
luislobo14rap / getFullPath.js
Last active January 30, 2021 22:30
getFullPath.js
// getFullPath.js v1.0.4
function getFullPath($element) { // jquery
if (typeof $element.jquery == 'undefined') {
$element = $($element);
};
let path = [];
// pause if $element is HTML
let thisIsHtml = false;
while (thisIsHtml == false) {
let tagName = $element.prop('tagName').toLowerCase();
@luislobo14rap
luislobo14rap / array-alias.js
Created November 10, 2019 20:27
array-alias.js
// array-alias.js v1
Array.prototype.add = function(){
return this.push(...arguments);
};
Array.prototype.add = Array.prototype.add; // alias
Array.prototype.addPrev = function(){
return this.unshift(...arguments);
};
Array.prototype.removeLast = function(quantity = 1){
console.log(quantity);
@luislobo14rap
luislobo14rap / cloudwards.js
Created November 9, 2019 20:35
cloudwards.js
// https://www.cloudwards.net/comparison/
$('.row.justify-content-center.cws_com__row').find('a').each(function(){
if( $(this).find('.img-fluid').length == 0 ){
$(this).addClass('title__');
}
});
all = [];
all2 = [];
index = -1;
@luislobo14rap
luislobo14rap / plyr-in-chrome.js
Last active October 31, 2023 09:18
plyr-in-chrome.js
// plyr-in-chrome.js v1.4
if(isLocalFile() | isLocalIp()){
const $ = (selector, scope = document) => {
return scope.querySelector(selector);
};
const createElement = (element) => {
return document.createElement(element);
};
@luislobo14rap
luislobo14rap / cookie-utils.js
Last active January 11, 2022 19:08
cookie-utils.js
@luislobo14rap
luislobo14rap / array-better-names.js
Created August 24, 2019 10:14
array-better-names.js
// array-better-names.js v1
Array.prototype.removeFirst = function(){
let this_ = this;
return this_.shift();
};
Array.prototype.removeLast = function(){
let this_ = this;
return this_.pop();
};
Array.prototype.addInFirst = function(value){
@luislobo14rap
luislobo14rap / gulp-infos.txt
Created August 16, 2019 19:54
gulp-infos.txt
gulp-infos.txt
__dirname;
process.cwd();
gulpfile-fs.txt
const fs = require('fs');
fs.readdirSync('.'); // [package.json, gulpfile.js, ...]
@luislobo14rap
luislobo14rap / atualizado.txt
Last active August 28, 2022 23:27
filegator-como-ftp-tutorial.txt
filegator\configuration.php
'adapter' => function () {
return new \League\Flysystem\Adapter\Local(
__DIR__.'/repository'
vira
'adapter' => function () {
return new \League\Flysystem\Adapter\Local(