Skip to content

Instantly share code, notes, and snippets.

View zeraphie's full-sized avatar

Izzy Skye zeraphie

View GitHub Profile
@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 / 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 / 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 / index.html
Created November 11, 2016 13:55
Really simple pure css arrow
<div class="arrow"></div>
@zeraphie
zeraphie / alberon.author
Last active October 6, 2016 14:36
Alberon comment authorship
/* ============================================================================
* __ __ *
* ____ _ / // /_ ___ _____ ____ ____ *
* / __ `// // __ \ / _ \ / ___// __ \ / __ \ *
* / /_/ // // /_/ // __// / / /_/ // / / / *
* \__,_//_//_.___/ \___//_/ \____//_/ /_/ *
* *
============================================================================ */
@zeraphie
zeraphie / build.sh
Created September 27, 2016 11:06
A simplified interaction to run gulp and git to deploy from a development site to gtilab/staging/live
#!/bin/bash
set -o nounset -o pipefail -o errexit
cd "$(dirname "$0")/../.."
################################################################################
# Master one liner interaction with deploying files
#
# Build the assets, then add and commit the files to git
# Then uploads the current branch to the live site, staging site and to GitLab
#
@zeraphie
zeraphie / gong.js
Created September 26, 2016 13:11
MAKE EVERYTHING ON A SITE GONG
(function(a){for(var b,c=document.createTreeWalker(document.querySelector("body"),NodeFilter.SHOW_TEXT,null,!1);b=c.nextNode();)b.nodeValue=a})('gong');
@zeraphie
zeraphie / cell-highlight.css
Created July 1, 2016 13:13
CSS Only solution to highlighting the current row and column
table {
float: left;
overflow: hidden;
position: relative;
width: 100%;
z-index: 2;
}
table tr {
-webkit-transition: background-color 0.3s;
@zeraphie
zeraphie / highlighter.js
Last active August 9, 2016 12:50
MathJax variable highlighting logic
(function($){
// MathJax highlighting jQuery plugin
// Highlights variables that are related to each other
// i.e. all variables that are the same and have superscript
// Note: Variables that have subscript are treated as a different
// variable
$.fn.highlighter = function(opts){
// Override defaults
opts = $.extend({
color: '#08c',
@zeraphie
zeraphie / linkscroll.js
Last active April 6, 2016 15:50
Scroll ze links
var animations = {
onload: function(callback) {
document.readyState === 'interactive' || document.readyState === 'complete' ? callback : document.addEventListener('DOMContentLoaded', callback);
},
renderize: function(fps, render) {
var fpsInterval, startTime, now, then, elapsed;
fpsInterval = 1000 / fps;
then = Date.now();
startTime = then;