Skip to content

Instantly share code, notes, and snippets.

View FutureMedia's full-sized avatar
💭
I may be slow to respond.

Lefteris Theodossiadis FutureMedia

💭
I may be slow to respond.
View GitHub Profile
@FutureMedia
FutureMedia / Fragmented Caching.php
Last active August 29, 2015 14:02 — forked from markjaquith/gist:2653957
by Mark Jaquith
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
function extract_string_from_array($array_of_strings, $comparison){
$array = array();
foreach ($array_of_strings as $string):
if (strstr($string, $comparison)):
array_push($array, $string);
endif;
endforeach;
return $array;
}
@FutureMedia
FutureMedia / WP Toolbox.md
Created May 31, 2014 10:03
A Wordpress toolbox

Client Side

  1. The jQuery plugin for equalizing the height or width of elements. https://github.com/tsvensen/equalize.js
  2. A jQuery plugin that adds cross-browser mouse wheel support with delta normalization. https://github.com/brandonaaron/jquery-mousewheel
  3. A fully responsive css framework that is impossibly small. https://github.com/mrmrs/fluidity
  4. PACE An automatic web page progress bar. https://github.com/HubSpot/pace
  5. MixItUp A jQuery plugin providing animated filtering and sorting. https://github.com/patrickkunka/mixitup
  6. BOOTFLAT an open source Flat UI KIT based on Bootstrap 3.1.1 CSS framework. https://github.com/bootflat/bootflat.github.io
  7. FLUIDBOX Replicating and improving the lightbox module seen on Medium with fluid transitions. http://terrymun.github.io/Fluidbox/
@FutureMedia
FutureMedia / custom-taxonomies-list.php
Created June 5, 2014 09:04
Return a list of the custom taxonomies with links. (WP)
<?php
// Return a list of the custom taxonomies with links
function get_custom_taxonomies_list() {
global $post, $post_id;
// get post by post id
$post = &get_post($post->ID);
// get post type by post
$post_type = $post->post_type;
// get post type taxonomies
$taxonomies = get_object_taxonomies($post_type);
@FutureMedia
FutureMedia / vpl.less
Created June 8, 2014 09:28
Normally to set the height of an element in relation to the browser window you need javascript. You can do the same using css Viewport Percentage Lengths.
.box {
height: 100vh;
width: 50vw;
}
/*
Note: The CSS height property is a bit tricky.
Setting the height:100% should make an element 100% the height of its parent.
This works, yes, but only when the parent has a fixed height.
*/
@FutureMedia
FutureMedia / offcanvas.js
Created June 19, 2014 16:11
Simple off canvas menu for mobile (less + js). Requires a toggle button for the activation.
<script>
// Toggles a show-nav class on the body element
$(function() {
$('.toggle').click(function() {
if ($('body').hasClass('show-nav')) {
// side panel closed
$('body').removeClass('show-nav');
} else {
// side panel open
$('body').addClass('show-nav');
@FutureMedia
FutureMedia / mouse-scrolling.md
Created July 2, 2014 10:03
Some resources & techniques about mouse scrolling, preferably horizontal scrolling.
@FutureMedia
FutureMedia / White-Space.markdown
Created July 3, 2014 09:05
A Pen by Tim Holman.
@FutureMedia
FutureMedia / illusory-cones.markdown
Created July 3, 2014 09:07
A Pen by Jon Faviell.
@FutureMedia
FutureMedia / simple-grid.scss
Last active August 29, 2015 14:07
Simple sass Grid that works
* {
@include box-sizing(border-box);
}
$pad: 20px;
.grid {
background: white;
margin: 0 0 $pad 0;