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
var waitForJQuery = setInterval(function () { | |
if (typeof jQuery != 'undefined') { | |
//your code here | |
clearInterval(waitForJQuery); | |
} | |
}, 10); |
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
/* | |
* arrive.js | |
* v2.4.1 | |
* https://github.com/uzairfarooq/arrive | |
* MIT licensed | |
* | |
* Copyright (c) 2014-2017 Uzair Farooq | |
*/ | |
var Arrive = function (e, t, n) { "use strict"; function r(e, t, n) { l.addMethod(t, n, e.unbindEvent), l.addMethod(t, n, e.unbindEventWithSelectorOrCallback), l.addMethod(t, n, e.unbindEventWithSelectorAndCallback); } function i(e) { e.arrive = f.bindEvent, r(f, e, "unbindArrive"), e.leave = d.bindEvent, r(d, e, "unbindLeave"); } if (e.MutationObserver && "undefined" != typeof HTMLElement) { var o = 0, l = function () { var t = HTMLElement.prototype.matches || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector; return { matchesSelector: function (e, n) { return e instanceof HTMLElement && t.call(e, n); }, addMethod: function (e, t, r) { var i = e[t]; e[t] = function () { return r.length == arguments.length ? r.apply(this, arguments) : "function" == typeof i ? i.appl |
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
/********* | |
* | |
* resize logos in custom galleries. | |
* | |
*/ | |
window.addEventListener("load", function() { | |
var images = document.querySelectorAll(".custom-gallery img"); | |
var adjustImageWidth = function (image) { | |
var widthBase = 250; |
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
// https://wordpress.stackexchange.com/questions/243697/zip-all-original-images-from-media-gallery | |
$query_images_args = array( | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image', | |
'post_status' => 'inherit', | |
'posts_per_page' => - 1, | |
); | |
$query_images = new WP_Query( $query_images_args ); |
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
response = await Promise.race([ | |
fetch('https://possibly.slow.io/' + options.token + '/get', { | |
method: 'POST', | |
body: JSON.stringify(data), | |
}), | |
new Promise((_, reject) => | |
setTimeout(() => reject(new Error('Timeout')), options.timeout) | |
), | |
]) |
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
const request = async () => { | |
const response = await fetch('https://api.com/values/1'); | |
const json = await response.json(); | |
console.log(json); | |
} | |
request(); | |
// https://dev.to/johnpaulada/synchronous-fetch-with-asyncawait |
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
npm config set prefix "/home/master/bin/npm/lib/node_modules" |
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 | |
// add to your theme's functions.php file | |
add_filter('upload_mimes', 'add_custom_upload_mimes'); | |
function add_custom_upload_mimes($existing_mimes) { | |
$existing_mimes['otf'] = 'application/x-font-otf'; | |
$existing_mimes['woff'] = 'application/x-font-woff'; | |
$existing_mimes['ttf'] = 'application/x-font-ttf'; | |
$existing_mimes['svg'] = 'image/svg+xml'; | |
$existing_mimes['eot'] = 'application/vnd.ms-fontobject'; | |
return $existing_mimes; |
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
// http://jillix.github.io/jQuery-sidebar/ | |
(function($){$.fn.sidebar=function(options){var self=this;if(self.length>1){return self.each(function(){$(this).sidebar(options)})}var width=self.outerWidth();var height=self.outerHeight();var settings=$.extend({speed:200,side:"left",isClosed:false,close:true},options);self.on("sidebar:open",function(ev,data){var properties={};properties[settings.side]=0;settings.isClosed=null;self.stop().animate(properties,$.extend({},settings,data).speed,function(){settings.isClosed=false;self.trigger("sidebar:opened")})});self.on("sidebar:close",function(ev,data){var properties={};if(settings.side==="left"||settings.side==="right"){properties[settings.side]=-self.outerWidth()}else{properties[settings.side]=-self.outerHeight()}settings.isClosed=null;self.stop().animate(properties,$.extend({},settings,data).speed,function(){settings.isClosed=true;self.trigger("sidebar:closed")})});self.on("sidebar:toggle",function(ev,data){if(settings.isClosed){self.trigger("sidebar:open",[data])}el |
NewerOlder