Skip to content

Instantly share code, notes, and snippets.

Jason McCreary jasonmccreary

Block or report user

Report or block jasonmccreary

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jasonmccreary
jasonmccreary / fixup.sh
Last active Sep 19, 2019
Shell function to "fixup" and "autosquash" a commit with a single command.
View fixup.sh
# ref: https://twitter.com/gonedark/status/1174460639005356032
# usage: fixup [ref]
function fixup() {
git commit --fixup="$1"
GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash "$1"~1
}
# credit: https://stackoverflow.com/questions/29094595/git-interactive-rebase-without-opening-the-editor
@jasonmccreary
jasonmccreary / .php_cs.laravel.php
Created Aug 9, 2019 — forked from laravel-shift/.php_cs.laravel.php
PHP CS Fixer - Laravel Ruleset
View .php_cs.laravel.php
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
'blank_line_after_namespace' => true,
@jasonmccreary
jasonmccreary / test-controllers.sh
Last active Jul 23, 2019
One-line shell script to generate HTTP Tests for your application's controllers.
View test-controllers.sh
# Run `artisan make:test` for all Controllers under `your app/Http/Controllers` folder.
# Created tests mirror their path under the `app` folder and are suffixed with "Test".
find app/Http/Controllers -type f -name '*Controller.php' -exec sh -c 'php artisan make:test $(dirname "${1:4}")/$(basename "$1" .php)Test' sh {} \;
@jasonmccreary
jasonmccreary / .php_cs.laravel
Created May 6, 2019
PHP CS Fixer - Laravel Presets + Customizations
View .php_cs.laravel
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'phpdoc_indent' => true,
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
@jasonmccreary
jasonmccreary / renamer.php
Created Jan 4, 2019
Scripts to rename posts filenames
View renamer.php
<?php
require 'vendor/autoload.php';
$renamed_posts = [];
foreach (new DirectoryIterator('source/_posts') as $file) {
if (!$file->isFile()) {
continue;
}
@jasonmccreary
jasonmccreary / condense-front-matter.php
Created Jan 4, 2019
Script to condense Jekyll front matter for Jigsaw
View condense-front-matter.php
<?php
require 'vendor/autoload.php';
$parser = new \Mni\FrontYAML\Parser();
$config = [
'whitelist' => ['title', 'excerpt', 'comments', 'categories', 'seo_image'],
'merge' => [
'extends' => '_layouts.post',
View config.php
<?php
return [
'baseUrl' => 'https://jasonmccreary.me',
'production' => true,
'siteName' => 'Jason McCreary',
'siteTitle' => 'I build things with my hands',
'siteDescription' => 'I build things with my hands',
'siteAuthor' => 'Jason McCreary',
@jasonmccreary
jasonmccreary / regex.md
Created Oct 26, 2018
Regex to convert old closure based view routes to Route::view()
View regex.md

The following regex will convert old, closure-based view routes from:

Route::get('faq', function () {
    return view('faq');
});

to the new, cacheable Route::view() introduced in Laravel 5.5.

@jasonmccreary
jasonmccreary / prep.md
Last active Jan 18, 2019
Prep: Start testing your PHP code
View prep.md

Start testing your PHP code

To prepare for this workshop, attendees should clone or download the start-testing-php repository and run composer install. This will install all the necessary tools to follow along with the live coding demos.

Requirements

While only PHP and Composer are required, if you would like to take the opportunity to set up a complete, local development environment, check out Homestead or Docker.

View getting-git-resources.md

Resources from the Getting Git workshop

These resources are either referenced during my Getting Git workshop or serve as materials for additional learning.

  • Pro Git - Recommend reading the first three chapters.
  • Git Flow and GitHub Flow - two of the popular branching models. I recommend GitHub Flow or more generally the master/feature branching model.
  • How to write a good commit message
  • My Blog - many of the recent articles go into more detail on Git commands and everyday scenarios we covered in the workshop.

In addition, the Getting Git workshop is based on the Getting Git video course. This can not only serve as a refresher, but also cover more commands and scenarios than the workshop.

You can’t perform that action at this time.