This file contains hidden or 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
// Add inline styles to WP admin | |
add_action('admin_head', 'colorpicker_styles'); | |
function colorpicker_styles() { | |
echo '<style> | |
.wp-picker-container .iris-picker { | |
height: 50px !important; | |
padding-top: 15px; | |
} | |
This file contains hidden or 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
(function() { | |
var href = window.location.href, | |
parser = document.createElement('a'); | |
parser.href = href; | |
var pageUrl = parser.pathname, | |
navLinks = document.querySelectorAll('nav.docs-nav ul li a'); | |
[].slice.call(navLinks).forEach(function(link, i) { |
This file contains hidden or 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
function clearParams() { | |
var uri = window.location.toString(); | |
if (uri.indexOf("?") > 0) { | |
var clean_uri = uri.substring(0, uri.indexOf("?")); | |
window.history.replaceState({}, document.title, clean_uri); | |
} | |
} |
This file contains hidden or 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
/** | |
* A simple drop-in snippet to ajaxify a site. | |
* If the user's browser doesn't support HTML5 History API, | |
* the site will navigate regularly. | |
* | |
* Change content and menu link selectors according to your need. | |
* | |
* Dependencies: jQuery 2+, jQuery.history | |
*/ | |
(function(window, jQuery){ |
This file contains hidden or 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
jQuery.extend(jQuery.easing, { | |
linear: function (t) { return t }, | |
// accelerating from zero velocity | |
easeInQuad: function (t) { return t*t }, | |
// decelerating to zero velocity | |
easeOutQuad: function (t) { return t*(2-t) }, | |
// acceleration until halfway, then deceleration | |
easeInOutQuad: function (t) { return t<.5 ? 2*t*t : -1+(4-2*t)*t }, | |
// accelerating from zero velocity | |
easeInCubic: function (t) { return t*t*t }, |
This file contains hidden or 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
h2, h3, h4, h5, h6 { | |
position: relative; | |
} | |
.permalink { | |
position: absolute; | |
left: -0.5em; | |
opacity: 0; | |
-webkit-transition: opacity 0.2s ease-in-out 0.1s; |
This file contains hidden or 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
/** | |
* Create permalinks for headings | |
* This snippet presumes the headings already have IDs | |
* (through Markdown or the likes). | |
* | |
* Sample styles are in the gist permalink.css | |
* https://gist.github.com/andreasvirkus/770004dc0180fba206933e3e48d3402b | |
* | |
* Dependencies: Font-Awesome (fa fa-link) for hyperlink symbols | |
*/ |
This file contains hidden or 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
/** | |
* Regular Expression IndexOf for Arrays | |
*/ | |
if (typeof Array.prototype.reIndexOf === 'undefined') { | |
Array.prototype.reIndexOf = function (rx) { | |
for (var i in this) { | |
if (this[i].toString().match(rx)) { | |
return i; | |
} | |
} |
This file contains hidden or 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
function timeStamp() { | |
var now = new Date(), | |
date = [ now.getMonth() + 1, now.getDate(), now.getFullYear() ], | |
time = [ now.getHours(), now.getMinutes(), now.getSeconds() ]; | |
// Leftpad seconds with 0 | |
for ( var i = 1; i < 3; i++ ) { | |
if ( time[i] < 10 ) { | |
time[i] = "0" + time[i]; | |
} |
This file contains hidden or 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
/** | |
* Get user's IPs using WebRTC (if supported) | |
* if WebRTC is not supported, ping FreeGeoIP.net | |
* | |
* partly from: https://github.com/diafygi/webrtc-ips | |
* | |
* @param onNewIP listener function for new IPs | |
*/ | |
function findIP(onNewIP) { | |
var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; //compatibility for firefox and chrome |