Skip to content

Instantly share code, notes, and snippets.

View beneverard's full-sized avatar

Ben Everard beneverard

View GitHub Profile
@beneverard
beneverard / gist:4543455
Created January 16, 2013 00:20
Do all font weight / names follow this pattern? Where 100 is hairline, etc.
100 Hairline
200 Extra Light
300 Light
400 Regular
500 Medium
600 Semibold
700 Bold
800 ???
900 Black
@beneverard
beneverard / gist:3834707
Created October 4, 2012 16:19
LESS .font-size mixin
.font-size(@font-size: 16) {
@rem: (@font-size / 16);
font-size: @font-size * 1px;
font-size: ~"@{rem}rem";
}
/* usage */
a {
.font-size(16); // 16px
}
@beneverard
beneverard / gist:3742942
Created September 18, 2012 12:56
Country codes
AF AFGHANISTAN
AL ALBANIA
DZ ALGERIA
AS AMERICAN SAMOA
AD ANDORRA
AO ANGOLA
AI ANGUILLA
AQ ANTARCTICA
AG ANTIGUA AND BARBUDA
AR ARGENTINA
<article>
<h2>Sections</h2>
<p>The main page header of this guide is an <code>h1</code> element. Any header elements may include links, as depicted in the example.</p>
<p>The secondary header above is an <code>h2</code> element, which may be used for any form of important page-level header. More than one may be used per page. Consider using an <code>h2</code> unless you need a header level of less importance, or as a sub-header to an existing <code>h2</code> element.</p>
<h3>Third-Level Header</h3>
<p>The header above is an <code>h3</code> element, which may be used for any form of page-level header which falls below the <code>h2</code> header in a document hierarchy.</p>
<h4>Fourth-Level Header</h4>
<p>The header above is an <code>h4</code> element, which may be used for any form of page-level header which falls below the <code>h3</code> header in a document hierarchy.</p>
dfgdfgdf
@beneverard
beneverard / gist:2498071
Created April 26, 2012 09:28
Calculate date from ISO 8601 week number
<?php
function get_week_number_date($week, $year)
{
// Count from '0104' because January 4th is always in week 1
// (according to ISO 8601).
$time = strtotime($year . '0104 +' . ($weekNumber - 1) . ' weeks');
// Get the time of the first day of the week
<?php
// when wordpress initialises, call our create event post type function
add_action('init', 'td_create_custom_post_type_event', 0);
function td_create_custom_post_type_event()
{
// set the singular and plural label here, we can reuse these below
$name = array(
@beneverard
beneverard / gist:1389103
Created November 23, 2011 16:19
Exposing WP url using shortcode
<?php
// slap this in your functions file
function wp_url_func($atts, $content=null)
{
return get_bloginfo('wp_url');
}
add_shortcode('wp_url', 'wp_url_func');
<?php
if (is_direct_call()) {
echo "abc";
}
?>
@beneverard
beneverard / gist:1184857
Created August 31, 2011 22:04
jqPagination Installation
$('.pagination').jqPagination({
paged: function(page) {
// do something with the page variable
}
});