Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Pebblo / functions.php
Last active May 26, 2020 21:07
Translate 'Attendee %d' & 'Attendee Information' to 'Participant %d' and 'Participant Information'.
<?php
//Please do not include the opening PHP tag.
function mycustom_filter_gettext( $translated, $original, $context, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
'Attendee Information' => 'Participant Information',
@cole007
cole007 / BEM rhyme
Created December 2, 2014 12:37
BEM rhyme for @kaelifa :D
Block is a house that is nice and square,
Element is a room with its walls all bare,
Modifier is the wallpaper, hang with care!
.house
.house__room
.house__room—-paisley
@urlsangel
urlsangel / loadDesktopImages.js
Last active December 25, 2015 11:58
loadDesktopImages.js
// loadDesktopImages is looking for spans with a data-img-src attribute, whose parent is visible
// Any parent visible with CSS will trigger the replacement of the span with an image tag
// We use gridset m-hide on images we want to hide from small devices
// <noscript> is there as a backup
/*
<div class="m-hide">
<span title="" class="media__image" data-img-src="http://fillmurray.com/200/300" style=""></span>
<noscript><img title="" alt="" class="media__image" src="http://fillmurray.com/200/300" style=""></noscript>
</div>
@adamjohnson
adamjohnson / retina-images.scss
Last active December 16, 2015 08:29
Painless retina images in Sass. Requires Compass.
// Painless Retina Images:
// =======================
// https://gist.github.com/adamjohnson/5406454
// http://blog.andrewckor.com/post/43347215341/retina-background-images-sass-mixin
// Requires Compass
// Suffix retina imagery with "@2x" & put in the same directory as normal assets (or specifiy a different directory in the @include)
@mixin bg-with-retina( $path, $img, $filetype, $size ) {
background-image: image-url( $path + $img + '.' + $filetype );
@include background-size( $size );
@xeoncross
xeoncross / google_doc_cms.php
Created April 1, 2013 20:03
Fetch a google doc, parse it, cache it, and display the content inside a webpage using PHP.
<?php
// Based on http://www.realisingdesigns.com/2009/10/29/using-google-docs-as-a-quick-and-easy-cms/
function getUrl($url, $expires = 5)
{
$cache_file = __DIR__ . '/cache/' . preg_replace('~\W+~', '-', $url) . '.txt';
if( ! is_dir(__DIR__ . '/cache') AND ! mkdir(__DIR__ . '/cache')) {
die('Please create /cache directory');
}
@zenorocha
zenorocha / multiple-3rd-party-widgets.js
Last active October 21, 2025 21:29
Loading multiple 3rd party widgets asynchronously
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@marcedwards
marcedwards / high-dpi-media.css
Last active September 24, 2025 23:32
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */