Skip to content

Instantly share code, notes, and snippets.

View obritoluis's full-sized avatar

Luís Brito obritoluis

  • Supermetrics
  • València, Spain
View GitHub Profile
# Remove previously tracked files
git ls-files -z ./ | xargs -0 git update-index --assume-unchanged --skip-worktree
@obritoluis
obritoluis / gist:ced0aa098600c1d2a0bca5127f3af2a5
Created March 14, 2020 23:05
freeCodeCamp: Roman Numeral Converter
function convertToRoman(num) {
// define roman numbers combinations
const romanCombinations = {
1: "I", 2: "II", 3: "III", 4: "IV", 5: "V", 6: "VI", 7: "VII", 8: "VIII", 9: "IX",
10: "X", 20: "XX", 30: "XXX", 40: "XL", 50: "L", 60: "LX", 70: "LXX", 80: "LXXX", 90: "XC",
100: "C", 200: "CC", 300: "CCC", 400: "CD", 500: "D", 600: "DC", 700: "DCC", 800: "DCCC", 900: "CM",
1000: "M"
}
if (num in romanCombinations) { // check if num is one of the combinations
@obritoluis
obritoluis / solution.js
Last active July 13, 2020 22:53
freeCodeCamp: Intermediate Algorithm Scripting: Smallest Common Multiple
function smallestCommons(arr) {
let firstNum = arr[0],
secondNum = arr[1],
primeFactors = [[],[]], //save the prime factors here
divider = 2, // start diving by two
counts = [{},{}]; //count how many times each prime factor appears
//get the firsNum prime factors
while (firstNum > 1) {
if (firstNum % divider === 0) {
@obritoluis
obritoluis / OpenWithSublimeText3.bat
Created May 3, 2018 12:16 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
javascript:(function(){document.body.innerHTML+="<style>*{background: #000 !important;color: #0f0 !important;outline: solid #f00 1px !important;}</style>";})();