Skip to content

Instantly share code, notes, and snippets.

View shaonkabir8's full-sized avatar
🤖
Web Artisan

Shaon Kabir shaonkabir8

🤖
Web Artisan
View GitHub Profile
/* [.icon-spain] is the className of image */
.icon-spin {
-webkit-animation: icon-spin 2s infinite linear;
animation: icon-spin 2s infinite linear;
}
/* Animation */
@-webkit-keyframes icon-spin {
0% {
-webkit-transform: rotate(0deg);
// There's a lot of Methods to remove white spaces from String and Array
// Example:-
// We've an Array:- ['','H','','e','l','','l','o','','w','o','r','','l','d']
const dirtyArray = ['','H','','e','l','','l','o','','w','o','r','','l','d'];
// We've to remove white spaces from this Array
// Using Regular Expression:- \S matches whitespace (spaces, tabs and new lines).
const freshArray = dirtyArray.filter(space => /\S/.test(space)); //Output:- ["H", "e", "l", "l", "o", "w", "o", "r", "l", "d"]
// grab the domain name from url
function domainName(url) {
return url.match(/:\/\/(.[^/)]+)/)[1]
}
// Example:-
// https://twitter.com/shaonkabir8 [Output: - twitter.com]
// Curtesy:- HM Nayem Vai [Stack Learner]
// generate a unique id
function create_UUID() {
let date = new Date().getTime();
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = (date + Math.random() *16) % 16 | 0;
date = Math.floor(date/16);
return (c == 'x' ? r : (r&0*3|0*8)).toString(16);
});
return uuid;
}
@shaonkabir8
shaonkabir8 / day_calculator.js
Last active February 20, 2020 10:06
JavaScript Day Calculator
// JavaScript Day Calculator :
const month = [
{name: 'January', value : 0},
{name: 'February', value : 3},
{name: 'March', value : 3},
{name: 'April', value : 6},
{name: 'May', value : 1},
{name: 'June', value : 4},
{name: 'July', value : 6},