Skip to content

Instantly share code, notes, and snippets.

View zeraphie's full-sized avatar

Izzy Skye zeraphie

View GitHub Profile
@zeraphie
zeraphie / alberon.author
Last active October 6, 2016 14:36
Alberon comment authorship
/* ============================================================================
* __ __ *
* ____ _ / // /_ ___ _____ ____ ____ *
* / __ `// // __ \ / _ \ / ___// __ \ / __ \ *
* / /_/ // // /_/ // __// / / /_/ // / / / *
* \__,_//_//_.___/ \___//_/ \____//_/ /_/ *
* *
============================================================================ */
@zeraphie
zeraphie / index.html
Created November 11, 2016 13:55
Really simple pure css arrow
<div class="arrow"></div>
@zeraphie
zeraphie / Junker.php
Last active February 1, 2017 12:21
A simple dump and exit function
<?php
namespace Junker;
/**
* Class Junker
*
* Dump some dismissable data - contains basic styles in order to help position
* the dump and make it clearer to use without
* clogging up some valuable screen space
@zeraphie
zeraphie / array-extract.php
Last active February 10, 2017 15:12
Extract items from an array (or collection for Laravel) using a callback function for comparison
<?php
if(!function_exists('arrayExtract')){
/**
* Extract items from an array and return them using a callback function to
* compare values
*
* @param array $arr
* @param Callable $callback
* @param bool $preserve
@zeraphie
zeraphie / lines-in-git-project.sh
Created February 27, 2017 15:13
Get the lines in a git project
# via http://stackoverflow.com/a/28858550
git diff --shortstat `git hash-object -t tree /dev/null`
@zeraphie
zeraphie / !-easy-lightbox.md
Last active June 27, 2017 14:33
This is just a really easy lightbox that can be used, created with minimal javascript and css

Easy Lightbox

This is just a really easy lightbox that can be used, created with minimal javascript and css, but has a bit of life and animation!

Demo is visible here https://codepen.io/zephyr/pen/XgzEyP

@zeraphie
zeraphie / !-easy-accordion.md
Last active July 17, 2017 13:12
A really easy way of doing responsive accordions

Easy Accordions

This was my attempt at making a really simple accordion with minimalistic code, taking advantage of a combination of scss and javascript.

It utilizes the offsetHeight method to measure the height of all the elements inside it, even if the max-height is set to 0 on the containing element, and as such, is pretty agnostic about what's contained inside!

Here's a demo: https://codepen.io/zephyr/pen/VWNNdg

@zeraphie
zeraphie / !-readme.md
Last active January 8, 2018 18:09
Service Worker

Service Workers

Below is some boilerplate for using service workers inside a project so that a web application can still run to some degree in an offline environment

  • register-service-worker.js would be loaded into your normal javascript
  • service-worker.js would be on it's own in the directory you wish to run the service worker inside (urls should reflect this)
  • Things in <> brackets will need to be replaced by their relevant information

Note: Service Workers can only be run in an SSL secured environment

@zeraphie
zeraphie / !-readme.md
Last active October 16, 2019 11:56
Add a service worker that can read a sitemap

Service Workers with a Sitemap Parser

This is a collection of ES2017 classes (so a transpiler is needed, webpack is used here with babel and the env preset) that utilize Service Workers to add offline support for a site. This example should work for WordPress sites as well

Installation

Because DOMParser is not included in Service Workers, you will need to install the npm package xmldom

npm install xmldom --save-dev

With Service Workers

@zeraphie
zeraphie / !-readme.md
Last active January 25, 2018 14:27
JavaScript Engine