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 / web.php
Created Mar 8, 2017
Laravel 5 - Routing an unknown number of sub-levels
View web.php
<?php
/*
|--------------------------------------------------------------------------
| Routing an unknown number of sub-levels
|--------------------------------------------------------------------------
|
| This is how you can route an unknown number of sub-levels and pass them
| to the same controller. For example, the following URLs will go through
| the same route:
|
@imliam
imliam / trigger.sql
Created Mar 8, 2017
MySQL - At least one column must have a value
View trigger.sql
/*
|--------------------------------------------------------------------------
| At least one column must have a value
|--------------------------------------------------------------------------
|
| This is a simple pair of triggers for MySQL databases that will disallow
| a row to be inserted into a table unless at least one of two predefined
| columns has a value set.
|
*/
@imliam
imliam / font_awesome_icon_helper.php
Created Mar 10, 2017
PHP - Font Awesome Icon Helper
View font_awesome_icon_helper.php
<?php
/*
|--------------------------------------------------------------------------
| PHP - Font Awesome Icon Helper
|--------------------------------------------------------------------------
|
| A helper function to build the HTML for a Font Awesome icon with all of
| the recommended accessibility tags.
|
*/
@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 / web.php
Created Mar 20, 2017
Laravel 5 - Route must start with @
View web.php
<?php
/*
|--------------------------------------------------------------------------
| Laravel 5 - Route must start with @
|--------------------------------------------------------------------------
|
| A quick snippet showing use of the Route::where(); method that lets you
| define a regex pattern for the route to match, such as the "@" symbol
| at the beginning to denote a user.
|
@imliam
imliam / nginx.conf
Created Mar 21, 2017
Nginx - Redirect www to non-www
View nginx.conf
server {
server_name www.yourdomain.com;
return 301 $scheme://yourdomain.com$request_uri;
}
@imliam
imliam / calculate.lua
Created Mar 29, 2017
Lua - Recursive Calculation
View calculate.lua
operation = {4, '+', 6, '-', 2}
function calculate(...)
local tbl={...}
if tbl[2] then
if tbl[2]=='+' then
table.insert(tbl, 1, tbl[1] + tbl[3])
table.remove(tbl, 2)
table.remove(tbl, 3)
table.remove(tbl, 4)
@imliam
imliam / atelier801.php
Created Mar 30, 2017
PHP - Atelier 801 Forum Request
View atelier801.php
<?php
class atelier801Forums {
public $session, $hiddenKey;
function __construct($user, $pass){
$this->session = new Requests_Session("http://atelier801.com/");
$this->setHeaders();
$this->GET("http://atelier801.com/forums");
$fields = array(
@imliam
imliam / data-hover-content.html
Last active Mar 31, 2017
jQuery - Hover Content Change
View data-hover-content.html
<button class="btn btn-primary" data-hover-content="Goodbye world">
Hello world
</button>
<button class="btn btn-primary" data-hover-element="#elementContent">
Button Content
</button>
<div id="elementContent" style="display:none;">
Element Content
</div>
View card-stack.css
/*
|--------------------------------------------------------------------------
| Card Stack
|--------------------------------------------------------------------------
|
| Adds a visual effect to make an element looks like there are multiple
| stacks of it. Uses white background and gray border, used for Bootstrap
| 4 cards.
|
*/
You can’t perform that action at this time.