Skip to content

Instantly share code, notes, and snippets.

new Promise(function(resolve, reject){
setTimeout(function(){
resolve(true);
}, 5000);
setTimeout(function(){
resolve(false);
}, 10000);
}).then(function(val){
if(val == true){
//...
.wpb_custom_raw_html{
border: 0;
padding: 0;
}
.wpb_custom_raw_html > .container{
width: 100%;
padding: 0;
}
.wpb_custom_raw_html > .container > .wpb_column > div{
padding: 0;
jQuery.fn.extend({
indexOf: function(selector) {
let thisElement = $(this);
if ($(this).constructor == $().constructor) {
if (typeof selector == 'undefined') {
return $(this).index();
};
if (!$(this).is(selector)) {
console.error('This element is not equal to the selector.');
return stopError;
jQuery.fn.extend({indexOf:function(a){let b=$(this);if($(this).constructor==$().constructor){if('undefined'==typeof a)return $(this).index();if(!$(this).is(a))return console.error('This element is not equal to the selector.'),stopError;let c=-1;return $(this).parent().children().each(function(){if($(this).is(a)&&c++,$(this).is(b))return!1}),c}return console.error('The "indexOf" function only accepts jquery elements.'),stopError}});
/* https://davidwalsh.name/detect-scrollbar-width */
.scrollbar-y-measure{width:100px;height:100px;overflow:scroll;position:absolute;top:-9999px}
$(function(){
//console.info('menu menuHighlight running');
let menuElement = $('.mc-menu')
, allElements = $('.mc-menu__top__logo, .mc-menu__top__menu-button')
, anchorMap = [];
$('.mc-menu__top__logo, .mc-menu__top__menu-button').each(function(){
anchorMap.push( $( $(this).attr('href') ) );
});
@luislobo14rap
luislobo14rap / bs-btn.css
Last active May 4, 2018 15:06
bootstrap buttons without background-colors and box-shadow
.btn:not(.btn-default):not(.btn-primary):not(.btn-success):not(.btn-info):not(.btn-warning):not(.btn-danger):not(.btn-link){
background-color: rgba(0, 0, 0, 0);
white-space: normal;
}
.btn:focus:not(.btn-default):not(.btn-primary):not(.btn-success):not(.btn-info):not(.btn-warning):not(.btn-danger):not(.btn-link){
box-shadow: none;
white-space: normal;
}
$('html, body').stop().animate({
scrollTop: 0
}, 1000);
function getLocalJSON(objName) {
if (typeof objName == 'string') {
if (localStorage.getItem('objJSON-' + objName) !== null) {
let objValue = localStorage.getItem('objJSON-' + objName);
return JSON.parse(objValue);
} else {
return {};
};
};
};
function setLocalJSON(objName, objValue) {
if (typeof objName == 'string') {
if (objValue.constructor == {}.constructor) {
localStorage.setItem('objJSON-' + objName, JSON.stringify(objValue));
} else {
console.error('setLocalJSON accepts only json objects.');
return false;
};
};
};