Skip to content

Instantly share code, notes, and snippets.

View RickardAhlstedt's full-sized avatar

Rickard Ahlstedt RickardAhlstedt

View GitHub Profile
<div class="toggle">
<input type="checkbox" class="check">
<b class="b switch"></b>
<b class="b track"></b>
</div>
@RickardAhlstedt
RickardAhlstedt / index.html
Created May 16, 2019 09:12
Waves Content Divider Using CSS
<svg class="editorial"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 24 150 28 "
preserveAspectRatio="none">
<defs>
<path id="gentle-wave"
d="M-160 44c30 0
58-18 88-18s
58 18 88 18
@RickardAhlstedt
RickardAhlstedt / gist:ac4e98dd944124789487d89cf85a814b
Created November 12, 2018 20:37 — forked from dukeofharen/gist:e2c60b4478408b53d743
WordPress like shortcode parser for PHP
<?php
//The content which should be parsed
$content = '<p>Hello, my name is John an my age is [calc-age day="4" month="10" year="1991"].</p>';
$content .= '<p>Hello, my name is Carol an my age is [calc-age day="26" month="11" year="1996"].</p>';
//The array with all the shortcode handlers. This is just a regular associative array with anonymous functions as values. A very cool new feature in PHP, just like callbacks in JavaScript or delegates in C#.
$shortcodes = array(
"calc-age" => function($data){
$content = "";
//Calculate the age
@RickardAhlstedt
RickardAhlstedt / index.pug
Created August 27, 2018 19:04
Only CSS: Spiral
#ui
.bg
.rings
- for (i = 0; i < 10; i++)
.ring
.border
<?php
/**
* Get either a gravatar URL or a complete image tag for a specified email
*
* @param string $sEmail The email address
* @param string $sSize The size on pixels, defaults to 80px [ 1 - 2048 ]
* @param string $sDefault Default imageset to use [ 404 | mp | identicon | monsterid | wavatar ]
* @param string $sRating Maximum rating (inclusive) [ g | pg | r | x ]
* @param boolean $bImg True to return the complete img-tag, false for just the URL
<?php
class Registry {
/**
* @var array The store for all objects
*/
static private $store = array();
/**