Skip to content

Instantly share code, notes, and snippets.

View mishalrai's full-sized avatar

Mishal Rai mishalrai

View GitHub Profile
@mishalrai
mishalrai / WP-bootstrap-pagination.php
Last active July 15, 2018 11:22
bootstrap pagination for WP
function mr_bootstrap_pagination($echo = true)
{
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
@mishalrai
mishalrai / viewChange.js
Last active April 6, 2018 07:17
Detect view
class slider extends utilities{
constructor() {
super();
/* -----------------------------------------------------------
* slider() function should place before
* viewChangeEevent Because those function listion event
* & viewChangeEvent trigger events( mobileView or desktopView)
* ----------------------------------------------------------- */
Query('.andels-slider').length > 0 && this.slider();
@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]);
}
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());
};
getNameNRenderElement() {
( () => {
let nameList = {},
returnObj = {};
return (args => {
if (Object.keys(nameList).length > 0) {
console.log(returnObj, 'return form momize');
@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
@-webkit-keyframes placeHolderShimmer{
0%{
background-position: -468px 0
}
100%{
background-position: 468px 0
}
}
@keyframes placeHolderShimmer{
0%{
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');
}
}
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");
@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 ){