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_action('after_setup_theme','remove_core_updates'); | |
function remove_core_updates(){ | |
if(! current_user_can('update_core')){return;} | |
add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2); | |
add_filter('pre_option_update_core','__return_null'); | |
add_filter('pre_site_transient_update_core','__return_null'); | |
} |
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
remove_action('load-update-core.php','wp_update_plugins'); | |
add_filter('pre_site_transient_update_plugins','__return_null'); |
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 getParam(url, param){ | |
if (typeof url != 'string' || typeof param != 'string'){ | |
return; | |
} | |
var regex = new RegExp('[\\?&]' + param + '=' + '(.+?)([&#]|$)', 'i'); | |
return (value = (regex.exec(window.location.href)||[,null])[1]) | |
? decodeURIComponent(value) | |
: null; | |
} |
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 getHash(url){ | |
if (typeof url != 'string'){ | |
return null; | |
} | |
return url.replace(/^.*(#.*)$/, '$1'); | |
} |
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
var sheet = (function() { | |
// Create the <style> tag | |
var style = document.createElement('style'); | |
// Add a media (and/or media query) here if you'd like! | |
// style.setAttribute('media', 'screen') | |
// style.setAttribute('media', 'only screen and (max-width : 1024px)') | |
// WebKit hack :( | |
style.appendChild(document.createTextNode('')); | |
// Add the <style> element to the page | |
document.head.appendChild(style); |
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
var elements = document.querySelectorAll("p"); // NodeList | |
var arrayElements = [].slice.call(elements); // Array de Nodes |
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
ar birthday = +new Date(dateString); | |
r |
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
var handleFileSelect = function(evt) { | |
var files = evt.target.files; | |
var file = files[0]; | |
if (files && file) { | |
var reader = new FileReader(); | |
reader.onload = function(readerEvt) { | |
var binaryString = readerEvt.target.result; | |
console.log(btoa(binaryString)); |
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 proportionalScale(originalSize, newSize){ | |
var ratio = originalSize[0] / originalSize[1]; | |
var maximizedToWidth = {width : newSize[0], height: (newSize[0] / ratio) }; | |
var maximizedToHeight = {width : newSize[1] * ratio, height: newSize[1]}; | |
if(maximizedToWidth[1] > newSize[1]) { | |
return maximizedToHeight; } | |
else { | |
return maximizedToWidth; | |
} |