Skip to content

Instantly share code, notes, and snippets.

View lunaroja's full-sized avatar

Abraham Velazquez Tello lunaroja

View GitHub Profile
@lunaroja
lunaroja / quickcurrency.js
Created February 2, 2012 19:25
Quick Currency formatter
/* JavaScript: US currency helper functions
-------------------------------------------------------*/
/**
* Formats any number, string or HTML string to a number with two trailing decimals
* @param {String} html Any number, string or HTML string
* @return {Number} Returns a number with two trailing decimals
*/
var toCurrency = function(html) {
var currency = html.match(/[\d\.]+/g);
@lunaroja
lunaroja / gist:3900723
Created October 16, 2012 17:27
iPhone 5 - Web-App Capable with no Letterbox
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="360">
<meta name="viewport" content="user-scalable=no">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0">
<meta name="viewport" content="width=320.1">
@lunaroja
lunaroja / gist:4043755
Created November 9, 2012 04:48
Open external link in new window with jQuery
$("a[href^='http']:not([href*='" + window.location.hostname + "'])").attr("target","_blank");
@lunaroja
lunaroja / gist:4126532
Created November 21, 2012 18:00
Sublime Text User Preferences
{
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Default/Pastels on Dark.tmTheme",
"draw_indent_guides": false,
"fade_fold_buttons": false,
"font_face": "Monaco",
"font_options":
[
"no_antialias"
],
@lunaroja
lunaroja / oldie.html
Created February 11, 2013 16:50
oldie html class
<!DOCTYPE html>
<!--[if lte IE 8]><html lang="en" class="no-js oldie"><![endif]-->
<!--[if gte IE 9]<!--><html class='no-js' lang='en'><!--<![endif]-->
<head>
<meta charset='utf-8' />
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible' />
<title>Title</title>
<meta content='width=device-width, initial-scale=1.0' name='viewport' />
</head>
@lunaroja
lunaroja / fb-debug.js
Created February 14, 2013 03:01
Open URL in Facebook Debugger
javascript: (function(){window.location='https://developers.facebook.com/tools/debug/og/object?q='+escape(window.location.href);})();
<?php
/**
* Premailer API PHP class
* Premailer is a library/service for making HTML more palatable for various inept email clients, in particular GMail
* Primary function is to convert style tags into equivalent inline styles so styling can survive <head> tag removal
* Premailer is owned by Dialect Communications group
* @link http://premailer.dialect.ca/api
* @author Marcus Bointon <marcus@synchromedia.co.uk>
*/
@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.
@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; ?>