Skip to content

Instantly share code, notes, and snippets.

View jackabox's full-sized avatar
🛠️
Available for Hire

Jack Whiting jackabox

🛠️
Available for Hire
View GitHub Profile
@jackabox
jackabox / csv_generate.php
Created April 10, 2018 09:18
Generate a CSV and provide it for download with a response in Laravel 5
<?php
public function export()
{
$headers = [
'Content-type' => 'text/csv',
'Content-Disposition' => 'attachment; filename=users.csv',
'Pragma' => 'no-cache',
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
'Expires' => '0'
];
@jackabox
jackabox / RecipeFactory.php
Last active March 18, 2018 15:41
Seeding with Faker/Factories and child relations
<?php
use Faker\Generator as Faker;
$factory->define(App\Models\Recipe::class, function (FakerGen $faker) {
return [
'title' => $faker->sentence,
'user_id' => 1,
'description' => $faker->text(400),
'serves' => $faker->numberBetween(1, 6),
@jackabox
jackabox / Icon.vue
Created March 15, 2018 22:56
Vue SVG Component
<template>
<span :class="'icon ' + this.classes"></span>
</template>
<script>
let cache = new Map();
export default {
props: {
src: {
@jackabox
jackabox / ContactController.php
Created November 13, 2017 11:48
Laravel - Sending reset to new User automatically
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
class ContactController extends Controller
{
public function create(Request $request)
@jackabox
jackabox / .bash_profile
Last active February 4, 2022 11:03
Install script for new mac setup
# PHP Switcher
phpv() {
valet stop
brew unlink php@5.6 php@7.0 php@7.1 php@7.2 php
brew link --force --overwrite $1
brew services start $1
composer global update
valet install
}
@jackabox
jackabox / README.md
Last active August 31, 2017 15:54
Minifying CSS [Incomplete]

Minify CSS Style

  • Status: Incomplete!

Info

Concats all enqueued stylesheets (and dequeues the one concats). Sets a transient and writes a file with the concatted values to cache it for a day. Adds an enqueue for load_css.php. Serves and minifies all contents via that file.

## Todo

<h2>1. Cookies</h2><p>By using the website of you consent to the usage of data captured by the use of cookies. Cookies allow us to do multiple things to enhance and improve your browsing experience on our website. If you wish to turn off cookies, please adjust your browser settings. Our website will continue to function without cookies.</p><p>We use cookies to track visitors to our website; these details are in no way personal or identifiable details and will never be shared. Our cookies are for the sole purpose of improving the performance of our website for you, the user; this includes allowing us to geo-target our users, to make websites more personal and relevant to you.</p><p><b>Below are the third party tools we use:</b></p><h3>Google Analytics</h3><p>Page views, source and time spent on website are part of the user website activities information we can see with this cookie. This information cannot be tracked back to any individuals as it is displayed as depersonalised numbers; this is in order to help
@jackabox
jackabox / gulpfile.js
Created June 27, 2017 10:43
Gulp with WP Theme
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglifyjs');
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
gulp.task('scss', function () {
return gulp.src('./scss/**/*.scss')
@jackabox
jackabox / autocomplete.js
Created May 11, 2017 09:15
Google Maps Autocomplete.js On Enter
(function($) {
"use strict";
function pacSelectFirst(input) {
var _addEventListener = (input.addEventListener) ? input.addEventListener : input.attachEvent;
function addEventListenerWrapper(type, listener) {
if (type == "keydown") {
var orig_listener = listener;
@jackabox
jackabox / httpd-vhost.conf
Created November 25, 2016 09:38
vhost wildcard for .dev domain
<VirtualHost *:80>
ServerAlias localhost *.dev
VirtualDocumentRoot /Users/%USERNAME%/Sites/websites/%1/public
UseCanonicalName Off
<Directory "/Users/%USERNAME%/Sites/Websites">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted