Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Ciphering Through my new M1 Mac

J. Alexander Curtis jacurtis

😀
Ciphering Through my new M1 Mac
View GitHub Profile
@jacurtis
jacurtis / _spacing-helpers.scss
Last active Apr 26, 2021
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
View _spacing-helpers.scss
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@jacurtis
jacurtis / regex.md
Last active Mar 18, 2021
Most Useful Regex's
View regex.md

Useful Regular Expressions

These are the most useful Regular Expressions that I find myself using on a regular basis


URLs

Test to see if a string is a valid website address or not.

All URLs
@jacurtis
jacurtis / USA-select-state-list.html
Last active Feb 16, 2021
A full list of USA states for using in an HTML state dropdown
View USA-select-state-list.html
<select>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
@jacurtis
jacurtis / 1) Main.blade.php
Created Feb 16, 2017
Laravel 5.4 Components & Slots
View 1) Main.blade.php
<!-- This is the main Blade file that you want your components to show up in -->
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
@jacurtis
jacurtis / about.blade.php
Created Feb 4, 2016
Build a Blog with Laravel Part 5.5 File Download
View about.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Laravel Blog</title>
@jacurtis
jacurtis / phpcs.xml
Created Jan 26, 2019
The PHP Code Sniffer configuration file I use for Laravel Applications. I had to remove PSR2 code just because it causes lots of problems with magic function in route files and models and stuff. But otherwise a good basic code sniffer config to use in Laravel projects.
View phpcs.xml
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<description>Laravel Coding Standards</description>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
@jacurtis
jacurtis / _media-queries.scss
Last active Aug 14, 2020
This will generate media query mixins with SCSS.
View _media-queries.scss
$mobile: 768px !default;
$tablet: 769px !default;
$desktop: 1024px !default;
$widescreen: 1216px !default;
$fullhd: 1408px !default;
// Mobile Devices Only
// (0 - 768px)
@mixin mobile {
@media only screen and (max-width: $mobile) {
@jacurtis
jacurtis / toast-notifications.blade.php
Last active Jul 28, 2020
Self Contained Vue.js Instance to Manage LaraFlash Notifications in Laravel
View toast-notifications.blade.php
{{--
This makes a great "partial" to add to your template layout file. It will self manage your
notifications so you do not need to worry about displaying them. Simply just add notifications
using LaraFlash (Laravel Package) in your controllers, and they will display intelligently
and elegantly into your views.
Simply use an @include statement in your main template/layout file to this partial so that
this partial is included with every view. The rest can be set once and forgotten.
Requirements:
@jacurtis
jacurtis / App\Exceptions\Handler.php
Created Jul 28, 2016
How to get filp/whoops to work in Laravel 5.2 or 5.3 - Add this code to your `App\Exceptions\Handler.php` file.
View App\Exceptions\Handler.php
/**
* Create a Symfony response for the given exception.
*
* @param \Exception $e
* @return mixed
*/
protected function convertExceptionToResponse(Exception $e)
{
if (config('app.debug')) {
$whoops = new \Whoops\Run;
@jacurtis
jacurtis / no-right-click-on-images.js
Last active Nov 25, 2019
Removes right-click on images
View no-right-click-on-images.js
/*
* This script will look for all images on a page and prevent right clicking on an image.
*/
const images = document.getElementsByTagName('img');
for(var i = 0; i < images.length; i++) {
images[i].addEventListener('contextmenu', event => event.preventDefault());
}
// Note: I threw this script together as requested by a subscriber. I personally don't recommend doing