Skip to content

Instantly share code, notes, and snippets.

Liam Hammett imliam

View GitHub Profile
@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 README.md

You can register the mixin class in the register method of a Laravel service provider:

use Illuminate\Foundation\Testing\TestResponse;

TestResponse::mixin(TestResponseMixin::class);
@imliam
imliam / popover-close-when-losing-focus.js
Created Mar 17, 2017
Bootstrap 4 - Close Popover When Losing Focus
View popover-close-when-losing-focus.js
/*
|--------------------------------------------------------------------------
| Bootstrap 4 - Close Popover When Losing Focus
|--------------------------------------------------------------------------
|
| A JavaScript snippet that closes a Bootstrap 4 popover when clicking off
| of it, but unlike the default behaviour, allows it to stay open when
| clicking within the popover itself.
*/
@imliam
imliam / popover-dom-content.html
Last active Jun 26, 2020
Bootstrap 4 - Load Popover Content From DOM
View popover-dom-content.html
<div id="unique-id" style="display:none;">
<div class="popover-heading">This is a heading</div>
<div class="popover-body">This is HTML content that will be loaded inside a </div>
</div>
<span tabindex="0" role="button" data-toggle="popover" data-placement="bottom" data-popover-content="#unique-id">
Click me to load a popover
</span>
@imliam
imliam / tfm-cookieclicker.lua
Last active Jun 9, 2020
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},
@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 / take.php
Last active Jan 15, 2020
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
*/
@imliam
imliam / query_string.php
Last active Nov 9, 2019
Laravel 5 - URL Query String Helper
View query_string.php
<?php
/*
|--------------------------------------------------------------------------
| Laravel 5 - URL Query String Helper
|--------------------------------------------------------------------------
|
| A helper function to take a URL string then quickly and easily add query
| string parameters to it, or change existing ones.
|
| url_queries(['order' => 'desc', 'page' => 2],
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?}';
@imliam
imliam / cmd.lua
Created Apr 26, 2017
Command line argument parsing
View cmd.lua
command_strings = {
'php artisan make="hi mate" heh "I have a value"',
"php artisan make:auth",
[[I "am" 'the text' and "some more text with '" and "escaped \" text"]],
[[1 2 word 2 9 'more words' 1 "and more" "1 2 34"]],
[[omo "This is a string!" size=14 font="Comic Sans" break= hmm "thing and 'thing'" ]]
}
function command_parse(s)
local t={}
You can’t perform that action at this time.