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
/** | |
* Given a string of words separated by spaces, return the first letter of the first two words. | |
* Originally intended to get the initials of a "name lastName" string. | |
* | |
* @param {string} words A list of words. Only the first two are taken into account the rest are ignored. | |
* | |
* @returns {string} | |
*/ | |
const getNameInitials = words => name.split(' ').slice(0, 2).reduce( (acc, cur) => acc + cur[0], '' ); |
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 | |
/** | |
* Plugin Name: Mueve los campos | |
* Plugin URI: http://elio.blog/ | |
* Description: Mueve los campos de nombre, sitio e email arriba de la caja de comentario. | |
* Author: @eliorivero | |
* Version: 0.0.7 | |
* Author URI: http://elio.blog/ | |
*/ |
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
$( document ).ajaxSend(function( e, request, settings ) { | |
// settings.url is something like http://queryloop.com/some-paginated-view/page/2/ | |
var page = settings.url.replace( /^(.*?)(\/page\/\d+\/)/i, '$2' ), | |
regex = /^\/page\/\d+\//i, | |
match; | |
if ( ( match = regex.exec( page ) ) !== null ) { | |
if ( match.index === regex.lastIndex ) { | |
regex.lastIndex++; | |
} |
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($){ | |
// Set a flag. | |
var didScroll = false; | |
// On scroll event, set the flag to true. | |
$(window).on('scroll', function() { | |
didScroll = true; | |
}); | |
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 | |
/** | |
* Plugin Name: ILC Shortbar | |
* Plugin URI: http://ilovecolors.com.ar/ | |
* Description: Creates creates multiple sidebars that can be called using a related shortcode. | |
* Author: Elio Rivero | |
* Author URI: http://ilovecolors.com.ar | |
* Version: 1.0.0 | |
*/ |
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 | |
/** | |
* Show Woocommerce custom attributes | |
*/ | |
global $product; | |
$custom_attributes = array(); | |
foreach ( $product->get_attributes() as $slug => $attr ) { |
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
/** | |
* Remove fixed width from embedded tweets. First step to make them responsive. | |
* @param string $html HTML that should be used to embed | |
* @param string $url The URL to the content that should be attempted to be embedded. | |
* @param array $args Optional arguments. | |
* @author Elio Rivero | |
* @link http://www.ilovecolors.com.ar/ | |
*/ | |
function themesrobot_oembed_result($html, $url, $args){ | |
// Check if it's a tweet looking for 'twitter' in the url pasted in the post |
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 isTouch() { | |
try { | |
document.createEvent('TouchEvent'); | |
return true; | |
} catch(e) { | |
return false; | |
} | |
} | |
jQuery(document).ready(function($) { |