Skip to content

Instantly share code, notes, and snippets.

View itsliamjones's full-sized avatar

Liam Jones itsliamjones

View GitHub Profile
@itsliamjones
itsliamjones / output-fraction.html
Created July 25, 2016 08:58
Pretty-ish way of outputting a fraction in HTML
1<sup>1</sup>&frasl;<sub>2</sub>
@itsliamjones
itsliamjones / .bowerrc
Created July 3, 2016 16:14 — forked from curiouslychase/.bowerrc
Gist for example bower project blog post.
{
"directory": "src/_lib",
"json": "bower.json"
}
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror [email protected]:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@itsliamjones
itsliamjones / array-value-recursive.php
Created May 26, 2016 13:54
Get all values from specific key in a multidimensional array, similar to array_columns
<?php
/**
* Get all values from specific key in a multidimensional array
*
* @param string $key key(s) of value you wish to extract
* @param array $arr where you want
*
* @return null|string|array
*/
@itsliamjones
itsliamjones / array-unique-fast.php
Last active May 26, 2016 13:52
PHP's inbuilt array_unique sucks, here's a significantly faster replacement for it
<?php
/**
* PHP's inbuilt array_unique sucks, here's a significantly faster replacement for it
*
* @param array $array
*
* @return array
*/
function array_unique_fast($array)
@itsliamjones
itsliamjones / string-contains.php
Last active May 10, 2016 09:26
Test to see if string contains ALL needles
<?php
/**
* Test to see if string contains ALL needles
*
* @param array $needles
* @param string $haystack
*
* @return boolean
*/
@itsliamjones
itsliamjones / php5-spaceship-operator.php
Last active May 10, 2016 09:24
PHP5 Three way comparison (Spaceship Operator)
<?php
/**
* PHP5 Three way comparison
*
* PHP7 This wouldn't be needed, instead you would do something along the lines of -
* if/switch ($left <=> $right) { ... }
*
* @param integer $left
* @param integer $right