Skip to content

Instantly share code, notes, and snippets.

View mishalrai's full-sized avatar

Mishal Rai mishalrai

View GitHub Profile
var arr = [1, 2, 3, 4, 5];
var index = 0;
function sendRequest(){
return new Promise( function(resolve, reject){
index++;
console.log(arr[index], index);
/**
* Show the Navigation around the screen
*/
+(function($){
class ShowNavOnScreen{
/**
* Initialize the necessory functions on initial load
@mishalrai
mishalrai / consoleWrapper.js
Created January 22, 2019 08:34
log only dev mode
const bg = {
devMode : BGJOBFINDER.devMode === 'dev'? true : false,
type: 'log',
log(...params){
this.common(...params);
},
info( ...params ){
window.onscroll = function() {myFunction()};
var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;
function myFunction() {
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
function myFunction(x) {
if (x.matches) { // If media query matches
document.body.style.backgroundColor = "yellow";
console.log('one time only');
} else {
document.body.style.backgroundColor = "pink";
console.log('pink');
}
}
@-webkit-keyframes placeHolderShimmer{
0%{
background-position: -468px 0
}
100%{
background-position: 468px 0
}
}
@keyframes placeHolderShimmer{
0%{
@mishalrai
mishalrai / LICENSE.txt
Created May 14, 2018 04:40 — forked from atk/LICENSE.txt
Cookie helper
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
getNameNRenderElement() {
( () => {
let nameList = {},
returnObj = {};
return (args => {
if (Object.keys(nameList).length > 0) {
console.log(returnObj, 'return form momize');
export const getRandomId = () => {
let random = function () {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
return (random() + random() + "-" + random() + "-" + random() + "-" + random() + "-" + random() + random() + random());
};
@mishalrai
mishalrai / utilitiesFn.js
Last active March 29, 2018 18:04
utilities fn in js
/******************************
* Arry unique
****************************** */
function arrUnique(arr){
let len = arr.length;
let newArr = [];
for( let i=0; i < len; i++ ){
if( newArr.indexOf(arr[i]) === -1){
newArr.push(arr[i]);
}