This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//------------------------------------------------------- | |
// Send Email | |
//------------------------------------------------------- | |
$to = 'test@example.com'; | |
$subject = 'Test mail'; | |
$message = 'Hello! This is a simple email message.'; | |
$from = 'someone@example.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------- | |
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function qs( cls ) | |
{ | |
return document.querySelector( cls ); | |
} | |
function qsa( cls ) | |
{ | |
return document.querySelectorAll( cls ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"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": " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body | |
{ | |
font-family: 'Segoe UI', Verdana, Arial, Helvetica, sans-serif; | |
background-color: whitesmoke; | |
line-height: 26px; | |
} | |
.container | |
{ | |
background: white; | |
border: 1px solid silver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.goto-top').on( | |
'click', | |
function(e){ | |
e.preventDefault(); | |
$('html, body').animate( { scrollTop: 0 } ); | |
} | |
); |