Skip to content

Instantly share code, notes, and snippets.

@imliam
imliam / web.php
Created March 8, 2017 16:01
Laravel 5 - Routing an unknown number of sub-levels
<?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 March 8, 2017 16:08
MySQL - At least one column must have a value
/*
|--------------------------------------------------------------------------
| 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 March 10, 2017 16:06
PHP - Font Awesome Icon Helper
<?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 / web.php
Created March 20, 2017 13:17
Laravel 5 - Route must start with @
<?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 March 21, 2017 09:44
Nginx - Redirect www to non-www
server {
server_name www.yourdomain.com;
return 301 $scheme://yourdomain.com$request_uri;
}
@imliam
imliam / calculate.lua
Created March 29, 2017 22:00
Lua - Recursive Calculation
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 March 30, 2017 03:04
PHP - Atelier 801 Forum Request
<?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 March 31, 2017 19:58
jQuery - Hover Content Change
<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>
@imliam
imliam / card-stack.css
Created March 31, 2017 20:06
Card Stack
/*
|--------------------------------------------------------------------------
| 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.
|
*/
@imliam
imliam / flip.css
Created April 5, 2017 16:37
Flip an Element
/* entire container, keeps perspective */
.flip-container {
perspective: 1000px;
}
/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;