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
@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 / popover-dom-content.html
Last active Dec 14, 2019
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 / 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={}
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},
@imliam
imliam / hamburger-spin.scss
Created Apr 5, 2017
Bootstrap 4 - Animated Hamburger Icon
View hamburger-spin.scss
// Additional spin to the animation.
.hamburger {
display: inline-block;
width: 1.5em;
height: 1.5em;
padding-top: 0.3em;
padding-bottom: 0.3em;
vertical-align: middle;
@imliam
imliam / pagination.blade.php
Last active Nov 26, 2018
Laravel 5 - Bootstrap 4 Pagination
View pagination.blade.php
<?php
/*
|--------------------------------------------------------------------------
| Laravel 5, Bootstrap 4 Pagination
|--------------------------------------------------------------------------
|
| A partial view to handle pagination for collections in Laravel's query
| builder or Eloquent ORM, styled with Bootstrap 4.
|
| The pagination displays like the following, where * denotes the current
@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',
]);
You can’t perform that action at this time.