Skip to content

Instantly share code, notes, and snippets.

View jacurtis's full-sized avatar

J. Alexander Curtis jacurtis

View GitHub Profile
@jacurtis
jacurtis / toast-notifications.blade.php
Last active July 7, 2021 21:35
Self Contained Vue.js Instance to Manage LaraFlash Notifications in Laravel
{{--
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 / about.blade.php
Created February 4, 2016 17:05
Build a Blog with Laravel Part 5.5 File Download
<!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 January 26, 2019 20:29
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.
<?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 / no-right-click-on-images.js
Last active November 25, 2019 18:08
Removes right-click on images
/*
* 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
@jacurtis
jacurtis / ServerNamingSchemes.md
Last active May 3, 2019 05:04
The techniques I use to name cloud servers.
environment-purpose-Name-Geography

Environment

  • dev - Development
  • tst - Testing
  • stg - Staging
  • prd - Production
@jacurtis
jacurtis / Reserved-Subdomains.json
Last active March 3, 2019 04:03
This is a JSON (or compatible with most language arrays) array that contains a list of subdomains that you want to reserve in multi-tentant applications.
[
"a",
"aa",
"about",
"abuse",
"access",
"account",
"accounts",
"ad",
"admin",
@jacurtis
jacurtis / mysql-cli.sql
Created January 26, 2019 02:04
This is the command I use to create all of my new MySQL databases in the CLI. Insert your own database name. This sets up new databases using the utf8mb4 character set in the most popular method.
CREATE DATABASE <database_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@jacurtis
jacurtis / atom-styles.less
Created December 12, 2018 17:57
This is the stylesheet I use in Atom to get the design I like. It requires Fira Code (mono font) and FlottFlott (ligature font). But you can swap out your own fonts by replacing them in the sheet.
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
<?php
if (!function_exists('timezoneArray')) {
/**
* description
*
* @param
* @return
*/
@jacurtis
jacurtis / gulpfile.js
Created July 26, 2016 23:46
My Default Gulpfile.js configuration. Using sass and browsersync
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
// Compile Sass + refresh browser sync
gulp.task('styles', function() {
return gulp.src('./sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream());