I hereby claim:
- I am davidpaulsson on github.
- I am davidpaulsson (https://keybase.io/davidpaulsson) on keybase.
- I have a public key whose fingerprint is 7F6E 0C62 26CB 9F49 B685 3C63 2246 ACB6 100C 1333
To claim this, I am signing this object:
import { sample } from 'lodash'; | |
import React from 'react'; | |
import cookie from 'cookie'; | |
import Layout from '../components/layout'; | |
import HomeV1 from '../components/scenes/home/v1'; | |
import HomeV2 from '../components/scenes/home/v2'; | |
const EXPERIMENT_OPTIONS = { | |
v1: HomeV1, | |
v2: HomeV2, |
// Usage: | |
// get_id_by_slug('any-page-slug'); | |
function get_id_by_slug($page_slug) { | |
$page = get_page_by_path($page_slug); | |
if ($page) { | |
return $page->ID; | |
} else { | |
return null; | |
} |
/** | |
* Place this inline at the bottom of the html document, right before | |
* closing `</body>`. It's important to have this inline as we want to | |
* display images asap. | |
* | |
* Markup example for the actual images. It also calculates the image | |
* container using the [padding-top hack](https://gist.github.com/davidpaulsson/10101985), | |
* please do this calculation on the back end, before drawing the DOM. | |
* Current example can load three images sizes, customize to fit your needs. It | |
* also adds the calculated image URL as an data-original tag on the img element it creates, |
var maxHeight = 0; | |
$('div').each(function(){ | |
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); } | |
}); | |
$('div').height(maxHeight); |
function foundation_pagination( $p = 2 ) { | |
if ( is_singular() ) return; | |
global $wp_query, $paged; | |
$max_page = $wp_query->max_num_pages; | |
if ( $max_page == 1 ) return; | |
if ( empty( $paged ) ) $paged = 1; | |
if ( $paged > $p + 1 ) p_link( 1, 'First' ); | |
if ( $paged > $p + 2 ) echo '<li class="unavailable"><a href="#">…</a></li>'; | |
for( $i = $paged - $p; $i <= $paged + $p; $i++ ) { // Middle pages | |
if ( $i > 0 && $i <= $max_page ) $i == $paged ? print "<li class='current'><a href='#'>{$i}</a></li> " : p_link( $i ); |
/*-------------------------------------------------------------- | |
Flexbox grid | |
--------------------------------------------------------------*/ | |
// Wrapper | |
.grid { | |
display: flex; | |
} | |
// Alignment per row |
Verifying that +davidpaulsson is my openname (Bitcoin username). https://onename.com/davidpaulsson |
I hereby claim:
To claim this, I am signing this object:
/* | |
* CSS needed for https://gist.github.com/davidpaulsson/10101172 | |
*/ | |
img { | |
max-width: 100%; | |
height: auto; | |
} | |
/* Non-fluid images if you specify `width` and/or `height` attributes. */ |
# An example Jekyll Liquid tag. Utilizes the new plugin system. | |
# | |
# 1. Make a _plugins directory in your jekyll site, and put this class in a file there. | |
# 2. In anyone of your pages, you can use the 'render_time' liquid tag like so: | |
# {% render_time Page generated at: %} | |
module Jekyll | |
class RenderTimeTag < Liquid::Tag | |
def initialize(tag_name, text, tokens) |