This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
// input = buildHTML('input', { | |
// type: 'hidden', | |
// value: response.csrf_token, | |
// name : '_token' | |
// }) | |
buildHTML = function(tag, html, attrs) { | |
// you can skip html param | |
if (typeof(html) != 'string') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http; | |
// composer require mailgun/mailgun-php php-http/curl-client guzzlehttp/psr7 | |
use Mailgun\Mailgun; | |
trait ValidatesEmailTrait { | |
/** | |
* Validates an email against Mailguns validation API, this is to reduce spam and nefarious login attempts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http; | |
/** | |
* Need to create goog recaptcha data before usage | |
*/ | |
use Request; | |
trait RecaptchaTrait { | |
public function validateCaptchaString($secret, $response_string, $remote_ip) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generates a comma delimited by column with newline character for rows of models. | |
* If needed to be used on a actual model and not fake data, just pass the methods following the factory to the collection. | |
*/ | |
$model = Model::class; | |
$quantity = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App; | |
trait Searchable { | |
/** | |
* Search for a model based off of the "fillable" property of the model | |
* @param type $query The query, no need to insert this into method as L typehints it | |
* @param string $term The search term | |
* @return type The modified query | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generate a hashed string that is URL save | |
* @param string $string The string to hash | |
* @return string Hashed string | |
*/ | |
function urlSafeHashMake($string) | |
{ | |
return strtr(base64_encode($string), '+/=', '-_,'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addResponsivePixelToBody() | |
{ | |
$('body').append('<div id="xs-res" class="hidden-sm hidden-md hidden-lg"></div><div id="small-res" class="hidden-md hidden-xs hidden-lg"></div><div id="medium-res" class="hidden-sm hidden-xs hidden-lg"></div><div id="large-res" class="hidden-sm hidden-xs hidden-md"></div><div class="col-sm-12 col-md-4 text-center">'); | |
} | |
function responsiveBreakpoints() | |
{ | |
var xs = $('#xs-res'); | |
var small = $('#small-res'); | |
var med = $('#medium-res'); | |
var large = $('#large-res'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds "user defined" shortcodes via ACF options and repeater plugins | |
*/ | |
function addUserDefinedShortCodes() | |
{ | |
if( have_rows('codes','option') ): | |
// loop through the rows of data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Good for fixin urls | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'.',' '); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,' ','-'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'--','-'); | |
UPDATE TABLE_NAME SET COLUMN = LOWER(COLUMN); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Š','S'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'š','s'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ð','Dj'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ž','Z'); |
OlderNewer