🤓 Code Snippets
Share and store your most common code snippets. Use our snippet explanation generator to use AI to try and explain the code.
defaults write com.apple.finder CreateDesktop true
killall Finder
















javascript on document loaded
document.addEventListener("DOMContentLoaded", function(){
//....
});
















How do I redirect to another webpage
// This is how to replace the URL
window.location.replace("http://stackoverflow.com");
// This is how to change the URL
window.location.href = "http://stackoverflow.com";
















$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~ # (1)
[ edit files as necessary ] # (2)
$ git add . # (3)
$ git commit -c ORIG_HEAD # (4)
















javascript get element by id
document.getElementById("demo");
















javascript get element by class name
var y = document.getElementsByClassName('foo');
var aNode = y[0];
















Route::view('/welcome', 'welcome');
Route::view('/welcome', 'welcome', ['name' => 'Taylor']);
















javascript get meta description
function getMeta(metaName) {
const metas = document.getElementsByTagName('meta');
for (let i = 0; i < metas.length; i++) {
if (metas[i].getAttribute('name') === metaName) {
return metas[i].getAttribute('content');
}
}
return '';
}
console.log(getMeta('video'));
















laravel include if
@includeIf('view.name')















