Skip to content

Instantly share code, notes, and snippets.

View Shakil-Shahadat's full-sized avatar
🏠
Working from home

Shakil Shahadat Shakil-Shahadat

🏠
Working from home
View GitHub Profile
@ingowennemaring
ingowennemaring / scrolltotop.js
Created April 18, 2013 14:16
Scroll to top of page
$('.goto-top').on(
'click',
function(e){
e.preventDefault();
$('html, body').animate( { scrollTop: 0 } );
}
);
@bbrochier
bbrochier / gotop.css
Last active May 27, 2018 19:00
Go Top Sticky button
/* Go Top */
.go-top {
position: fixed;
bottom: 2em;
right: 2em;
text-decoration: none;
color: white;
background-color: #f6f6f6;
background-color: rgba(0, 0, 0, 0.3);
font-size: 12px;
@Shakil-Shahadat
Shakil-Shahadat / common.css
Last active June 23, 2024 22:48
★ Some Common CSS Styles I Regularly Use
body
{
font-family: 'Segoe UI', Verdana, Arial, Helvetica, sans-serif;
background-color: whitesmoke;
line-height: 26px;
}
.container
{
background: white;
border: 1px solid silver;
[{"quote": "Life isn’t about getting and having, it’s about giving and being.", "author": "Kevin Kruse"},
{"quote": "Whatever the mind of man can conceive and believe, it can achieve.", "author": "Napoleon Hill"},
{"quote": "Strive not to be a success, but rather to be of value.", "author": "Albert Einstein"},
{"quote": "Two roads diverged in a wood, and I—I took the one less traveled by, And that has made all the difference.", "author": "Robert Frost"},
{"quote": "I attribute my success to this: I never gave or took any excuse.", "author": "Florence Nightingale"},
{"quote": "You miss 100% of the shots you don’t take.", "author": "Wayne Gretzky"},
{"quote": "I’ve missed more than 9000 shots in my career. I’ve lost almost 300 games. 26 times I’ve been trusted to take the game winning shot and missed. I’ve failed over and over and over again in my life. And that is why I succeed.", "author": "Michael Jordan"},
{"quote": "The most difficult thing is the decision to act, the rest is merely tenacity.", "author": "
@Shakil-Shahadat
Shakil-Shahadat / element.js
Last active June 22, 2024 15:02
[ Delete ] Create an Element in JavaScript
// Create an Element
let ele = document.createElement( 'div' ); // Replace 'div' with required element
// Insert Text
ele.innerText = 'Hello World!';
// or
ele.innerHTML = 'Hello World!';
// or, not recommended
let textNode = document.createTextNode( 'Hello World!' ); // Create a text node
ele.appendChild( textNode );
@Shakil-Shahadat
Shakil-Shahadat / query.js
Last active June 20, 2024 03:51
[ Delete ] Functions to shorten querySelector* calls in JavaScript
function qs( cls )
{
return document.querySelector( cls );
}
function qsa( cls )
{
return document.querySelectorAll( cls );
}
@Shakil-Shahadat
Shakil-Shahadat / miscellaneous.js
Last active June 24, 2024 02:55
★ Miscellaneous JavaScript Codes
//-------------------------------------------------------
// Add target="_blank" attribute to all anchor tags
//-------------------------------------------------------
// Add target="_blank" to all anchor tags, v 1.05
for ( x of document.querySelectorAll( 'a' ) ) x.setAttribute( 'target', '_blank' );
//-------------------------------------------------------
// Functions to shorten querySelector* calls
@Shakil-Shahadat
Shakil-Shahadat / loopOverArray.js
Last active June 20, 2024 19:07
[ Delete ] Summary of 'for / in' & 'for / of' loop
let fruits = [ 'apple', 'orange', 'mango' ];
// for / of loop
for ( e of fruits )
{
// e is now an element of the array
console.log( e ); // Output: apple, orange, mango
}
// for / in loop
@Shakil-Shahadat
Shakil-Shahadat / miscellaneous.php
Last active June 23, 2024 23:15
★ Miscellaneous PHP Codes
<?php
//-------------------------------------------------------
// Send Email
//-------------------------------------------------------
$to = 'test@example.com';
$subject = 'Test mail';
$message = 'Hello! This is a simple email message.';
$from = 'someone@example.com';