Skip to content

Instantly share code, notes, and snippets.

View lunaroja's full-sized avatar

Abraham Velazquez Tello lunaroja

View GitHub Profile
@lunaroja
lunaroja / jquery.getParam.js
Created May 2, 2013 05:57
Simple jQuery plugin that gets URL parameter by name for either address or specific url.
jQuery.extend({
getParam: function(n,u) {
if(!u) var u = window.location.search;
var match = RegExp('[?&]' + n + '=([^&]*)').exec(u);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
});
@lunaroja
lunaroja / exclude-from-home.php
Created April 29, 2013 16:00
Wordpress Query: Hide posts from home page based on meta key and still allow pagination.
<?php
if ( is_home() ) {
global $wp_query;
$args = array_merge( $wp_query->query, array(
'meta_query' => array(
array(
'key' => 'hidefromhome',
'value' => 0
)
@lunaroja
lunaroja / clean-text.js
Created April 18, 2013 22:57
quickly grab and array and log out a cleaned version of the text for urls or other sorts
for (var i = 0; i < copy.length; i++) {
console.log(copy[i].toLowerCase().replace(/[^\w\s]/gi, '').replace(/\s+/g, '-'));
};
@lunaroja
lunaroja / checkall.js
Created April 17, 2013 00:57
check all checkboxes on page
var checkboxes = document.querySelectorAll("input.checkbox");
for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].click(); };
@lunaroja
lunaroja / Preferences.sublime-settings
Last active May 13, 2016 17:17
Sublime Text 3 User Preferences
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
@lunaroja
lunaroja / horizontalScroll.css
Created April 3, 2013 16:03
simple horizontal scrolling div with iOS touch support.
.horizontalScroll {
width: 100%;
height: 200px;
overflow: scroll;
overflow-y: hidden!important;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
@lunaroja
lunaroja / app.js
Created March 13, 2013 19:30
Simple object fire based on document body ID (Simplified version from Paul Irish)
var APP = APP || {};
APP.fire = {
init : function () {
},
index : function () {
},
@lunaroja
lunaroja / events-feed-rss2.php
Last active December 14, 2015 11:29
display event data in rss feed in wp-includes/feed-rrs2.php
<?php if ('tribe_events' == get_post_type()) : ?>
<eventStartDate><?php echo tribe_get_start_date(); ?></eventStartDate>
<eventEndDate><?php echo tribe_get_end_date(); ?></eventEndDate>
<eventCost><?php echo tribe_get_cost(); ?></eventCost>
<venueName><?php echo tribe_get_venue(get_the_ID(), true); ?></venueName>
<venueAddress><?php echo tribe_get_address(get_the_ID(), true); ?></venueAddress>
<venueCity><?php echo tribe_get_city(get_the_ID(), true); ?></venueCity>
<venueState><?php echo tribe_get_region(get_the_ID(), true); ?></venueState>
<venueZip><?php echo tribe_get_zip(get_the_ID(), true); ?></venueZip>
<?php endif; ?>
@lunaroja
lunaroja / emogrifier.php
Created February 24, 2013 05:23
Emogrifier (http://www.pelagodesign.com/sidecar/emogrifier/) automagically transmogrifies your HTML by parsing your CSS and inserting your CSS definitions into tags within your HTML based on your CSS selectors. Emogrifier is provided under the terms of the MIT license: 1: http://www.opensource.org/licenses/mit-license.php 2: http://en.wikipedia.…
<?php
/*
UPDATES
2008-08-10 Fixed CSS comment stripping regex to add PCRE_DOTALL (changed from '/\/\*.*\*\//U' to '/\/\*.*\*\//sU')
2008-08-18 Added lines instructing DOMDocument to attempt to normalize HTML before processing
2008-10-20 Fixed bug with bad variable name... Thanks Thomas!
2008-03-02 Added licensing terms under the MIT License
Only remove unprocessable HTML tags if they exist in the array
2009-06-03 Normalize existing CSS (style) attributes in the HTML before we process the CSS.