Skip to content

Instantly share code, notes, and snippets.

View Silverium's full-sized avatar
💭
Open to work 100% remote

Soldeplata Saketos Candela Silverium

💭
Open to work 100% remote
View GitHub Profile
@Silverium
Silverium / orderScriptAndTemplateTagsInSFC.js
Last active February 28, 2019 17:50
Node script that reads the vue SFC files of all the tree of a directory and reorders their script, template and style tags
// execute it with command "node orderScriptAndTemplateTagsInSFC.js [ <dir> ]"
const fs = require('fs');
function orderScriptAndTemplateTagsInSFC() {
// 1. Read files / directories of path given to the script through parameter and create an array.
const directory = process.argv[2] || __dirname;
const paths = fs.readdirSync(directory)
.filter(filepath => !filepath.match(/^\./)); // remove hidden files or folders
const isVue = filepath => /.*\.vue$/.test(filepath);
@Silverium
Silverium / amicable.js
Created August 7, 2018 12:13
Amicable Numbers. Números amigos
function sumProperDivisors(num) {
return [...Array(Math.floor(num / 2))].reduce((acc,v, ind) => (num % (ind + 1)) === 0 ? (acc + ind + 1) : acc, 0)
}
function areAmicableNumbers(num1, num2) {
return sumProperDivisors(num1) === num2 && sumProperDivisors(num2) === num1
}
function amicableNumbersInRange(start,end){
let nums = [...Array(Number.parseInt((end - start) / 2))].map((v,i)=>start+i);
return [...nums.reduce((acc, v, i) => {
const possibleAmical = sumProperDivisors(v);
@Silverium
Silverium / prototyping.js
Last active May 19, 2021 09:50
JavaScript prototyping Object and Array helpers
if (!Array.prototype.hasOwnProperty('concatAll')) {
Object.defineProperty(Array.prototype, 'concatAll', {
value: function () {
let results = [];
for (const subArray of this) {
results = results.concat(subArray);
}
return results;
},
writable: true,
@Silverium
Silverium / extendInfojobsApplicationList.user.js
Last active August 29, 2015 14:23
List in application to jobs is right now limited to 30 items. This greasemonkey patch gives you the possibility to extend it to 50 and 100.
// ==UserScript==
// @description Extend the list of job applications from 30 to 50 and 100.
// @include https://www.infojobs.net/candidate/applications/*
// @name Extend Infojobs' Applications List
// @name:es-MX Ampliar la lista de candidaturas de InfoJobs
// @downloadURL https://gist.github.com/Silverium/c058ce671ee0fb6825fb
// @updateURL https://gist.github.com/Silverium/c058ce671ee0fb6825fb
// @namespace github.com/Silverium
// @author Soldeplata Saketos Candela
// @version 1
@Silverium
Silverium / DiscardedInfojobsOffers.user.js
Last active August 29, 2015 14:23
This greasemonkey script displays as discarded InfoJobs.net' offers that user is not interested anymore. It also adds a button of "Discard" next to the button of "Inscribe".
// ==UserScript==
// @description Display as discarded InfoJobs.net' offers that user is not interested anymore.
// @description Add a button of "Discard" next to the button of "Inscribe".
// @include https://www.infojobs.net/*
// @name Discarded Infojobs' Offers
// @name:es-MX Ofertas de InfoJobs Descartadas
// @downloadURL https://gist.github.com/Silverium/c443b8fb77a7f51b3c71
// @updateURL https://gist.github.com/Silverium/c443b8fb77a7f51b3c71
// @namespace github.com/Silverium
// @author Soldeplata Saketos Candela
@Silverium
Silverium / config.json
Created February 17, 2015 23:59
golden version of bootstrap
{
"vars": {
"@gray-base": "#291F00",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#B89300, 6.5%)",
"@brand-success": "#00CC00",