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
add_filter('oembed_dataparse','oembed_youtube_add_wrapper',10,3); | |
function oembed_youtube_add_wrapper($return, $data, $url) { | |
if ($data->provider_name == 'YouTube') { | |
return "<div class='youtube-wrapper'>{$return}</div>"; | |
} else { | |
return $return; | |
} | |
} |
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_action( 'wp_footer', 'scripts_for_adding_country_prefix_on_billing_phone' ); | |
function scripts_for_adding_country_prefix_on_billing_phone(){ | |
?> | |
<script type="text/javascript"> | |
( function( $ ) { | |
$( document.body ).on( 'updated_checkout', function(data) { | |
var ajax_url = "<?php echo admin_url('admin-ajax.php'); ?>", | |
country_code = $('#billing_country').val(); | |
var ajax_data = { |
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 | |
$database_name = ''; | |
$username = ''; | |
$password = ''; | |
$host = ''; | |
// Get connection object and set the charset | |
$conn = mysqli_connect($host, $username, $password, $database_name); | |
$conn->set_charset("utf8"); |
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
#!/bin/bash | |
# | |
# Download the latest Wordpress version | |
# | |
wget http://wordpress.org/latest.tar.gz | |
tar xfz latest.tar.gz | |
mv wordpress/* ./ | |
rmdir ./wordpress/ | |
rm -f latest.tar.gz |
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
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro (https://gist.github.com/macbleser/9136424) | |
# | |
WP_ROOT=${1:-.} # <-- wordpress root directory, current directory by default | |
[ -e "$WP_ROOT/wp-config.php" ] || { echo "Usage: $0 /path/to/wordpress"; exit; } # <-- detect that the directory is a wordpress root |
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
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro (https://gist.github.com/macbleser/9136424) | |
# | |
WP_ROOT=${1:-.} # <-- wordpress root directory, current directory by default | |
[ -e "$WP_ROOT/wp-config.php" ] || { echo "Usage: $0 /path/to/wordpress"; exit; } # <-- detect that the directory is a wordpress root | |
WP_OWNER=$(id -u $(logname)) # <-- wordpress owner (This assumes the wordpress owner is the logged in user) |
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 | |
/* Hide Wordpress Notifications */ | |
function remove_core_updates(){ | |
global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,); | |
} | |
add_filter('pre_site_transient_update_core','remove_core_updates'); // For WordPress | |
add_filter('pre_site_transient_update_plugins','remove_core_updates'); // For all plugins | |
add_filter('pre_site_transient_update_themes','remove_core_updates'); // For all themes |
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
/** | |
* multipleEventsListeners.js | |
* Add the capability to attach multiple events to an element, just like jQuery does | |
* https://gist.github.com/juanbrujo/a1f77db1e6f7cb17b42b | |
*/ | |
function multipleEventsListeners(elem, events, func) { | |
var event = events.split(' '); | |
for (var i = 0; i < event.length; i++) { | |
elem.addEventListener(event[i], func, false); |
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
function struuid($entropy) | |
{ | |
$s=uniqid("",$entropy); | |
$num= hexdec(str_replace(".","",(string)$s)); | |
$index = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; | |
$base= strlen($index); | |
$out = ''; | |
for($t = floor(log10($num) / log10($base)); $t >= 0; $t--) { | |
$a = floor($num / pow($base,$t)); |
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
### Keybase proof | |
I hereby claim: | |
* I am juanjosezg on github. | |
* I am juanjosezg (https://keybase.io/juanjosezg) on keybase. | |
* I have a public key ASBib1CwRFgUl5PQDafdkTYsZoKTTG1wh1_TGzyn6TqkLwo | |
To claim this, I am signing this object: |
NewerOlder