Skip to content

Instantly share code, notes, and snippets.

Liam Hammett imliam

Block or report user

Report or block imliam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View RouteViewDirMacro.php
/**
* Register a new wildcard route that returns a view if it exists.
*
* @param string $path
* @param string $viewDirectory
* @param array $data
* @return \Illuminate\Routing\Route
*/
\Route::macro('viewDir', function ($path, $viewDirectory = null, $data = []) {
$pathWithSegments = trim($path, '/') . '/{page?}';
View spacing_utilities.scss
/*
|--------------------------------------------------------------------------
| Spacing
|--------------------------------------------------------------------------
|
| Utilities for controlling an element's padding and margin.
|
*/
$spacing-class: (
@imliam
imliam / tfm-cookieclicker.lua
Last active Jan 15, 2019
Cookie Clicker game remade in Lua as a Transformice module
View tfm-cookieclicker.lua
--http://cookieclicker.wikia.com/wiki/Upgrades
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tick=0
timePassed=0
players={}
map=[[<C><P L="1600" /><Z><S><S L="1600" H="48" X="800" Y="380" T="12" P="0,0,0.3,0.2,0,0,0,0" /></S><D><DS Y="345" X="400" /></D><O /><L /></Z></C>]]
img={
cookie={"168537abe8d",250,250},
View weighted-search.sql
-- Weigh rows against eachother based on different conditions,
-- ordering the results based on their given weights so that
-- more precise matches will show higher up in the results.
-- In this example, an exact match will show up at the top
-- of the results, a match at the beginning of the string
-- will show next, and a match anywhere will show last.
set @query = 'Liam';
@imliam
imliam / example.php
Created Aug 23, 2018
Define a set of constants to be used as flags for bitmasked options.
View example.php
<?php
set_bitmask_flags([
'FLAG_1',
'FLAG_2',
'FLAG_3',
'FLAG_4',
'FLAG_5',
]);
@imliam
imliam / sizing-helpers.scss
Created Aug 9, 2018
Utilities for controlling an element's padding and margin.
View sizing-helpers.scss
/*
|--------------------------------------------------------------------------
| Spacing
|--------------------------------------------------------------------------
|
| Utilities for controlling an element's padding and margin.
|
*/
$spacing-class: (
@imliam
imliam / operator-mono-lig.css
Created Jul 5, 2018
Use the Operator Mono Lig typeface on any website.
View operator-mono-lig.css
/** General websites **/
code { font-family: "Operator Mono Lig" !important; font-weight: 200; }
pre > code { font-family: "Operator Mono Lig" !important; font-size: 1.2em !important; font-weight: 200; }
/** GitHub **/
.blob-code-inner, .blob-num, .highlight pre { font-family: "Operator Mono Lig" !important; font-weight: 200; }
.pl-c, .pl-e { font-style: italic; }
.pl-c { color: #4CAF50; }
/** Prism JS **/
View pipe_class.php
<?php
define('PIPE_VALUE', '__pipe-' . uniqid());
class Pipe implements ArrayAccess, Iterator, Serializable
{
public $value;
private $position = 0;
public function __construct($value)
View catch-exit.php
<?php
if (! function_exists('catch_exit')) {
/**
* Catch when a part of a script exits and execute a custom function at
* that point. Note that if exiting, the script does not continue.
* You can use this to, for example, flash a message and
* redirect the user instead of showing the default
* black text on white background "exit" view.
*
@imliam
imliam / take.php
Last active Sep 6, 2019
Run functions consecutively by piping through the result of one into the next.
View take.php
<?php
if (! function_exists('take')) {
/**
* Run functions consecutively by piping through the result of one
* into the next.
*
* @param mixed $value A value
*
* @return object
*/
You can’t perform that action at this time.