Skip to content

Instantly share code, notes, and snippets.

View anthony2025's full-sized avatar
🛵

Anthony Ascencio anthony2025

🛵
  • Alexandria, VA
View GitHub Profile
function romanizer(num) {
var result = '';
var decimals = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
var roman = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'];
for (var i = 0; i < decimals.length; i++) {
while (num >= decimals[i]) {
result += roman[i];
num -= decimals[i];
}
}
"Beginners get confused as to why a file doesn’t disappear from history when they place it into their .gitignore file.
The answer to this is quite simple! When you tell Git to ignore files, it’s going to only stop watching changes for that file,
and nothing else. This means that the history will still remember the file and have it.
If you want to remove a file from the repository, but keep it in your working directory, simply use:
git rm --cached <file>
However, this will still keep the file in history. If you actually want to remove it from history, you really have two options:
rewrite your repository’s commits, or start over.
Both options really suck, and that’s for a good reason: Git tries hard not to lose your data.
Just like with rebasing, Git forces you to think about these kinds of options since they are destructive operations.
If you did actually want to remove a file from history, git filter-branch is the hacksaw you’re looking for.
Math.floor(Math.random() * (max - min + 1)) + min
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git
Find:
lsof -i : portgoeshere
Kill:
kill -9 <PID>
mongoimport -h <host(Optional if local)> -d <db> -c <collection> -u <user> -p <pass> --jsonArray --file <file path>
git push origin :branch-name
.set('toJSON', {transform : function (doc, ret) {
delete ret._id;
return ret;
}});
/*
ON CONSOLE
const images = document.getElementsByTagName('*');
let srcList = [];
for (let i = 0; i < images.length; i++) {
srcList.push(images[i].style.backgroundImage);
}
*/
const pizzaGuy = require('pizza-guy')