// bad
const fruit = ['apple', 'banana', 'cucumber']
// okay
const fruitArr = ['apple', 'banana', 'cucumber']
// good
I like writing well-formed git commits that explain the intention behind why a code change was made.
Check out Chris Beams excellent How to Write a Git Commit Message if you haven't read it.
Anyway, for a project I've been working on I've gathered up 900+ commits that hold up a pretty high quality (except for one 😁). Let's look at some trends about these commits!
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
const intercept = (urlmatch, newurl) => { | |
const open = XMLHttpRequest.prototype.open; | |
XMLHttpRequest.prototype.open = function (method, url, ...rest) { | |
url = url.replace(urlmatch, newurl); | |
return open.call(this, method, url, ...rest); | |
}; | |
} | |
intercept('example.com', 'example2.com'); |
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 FinalClass; | |
require_once __DIR__ . '/vendor/autoload.php'; | |
use PHPUnit\Framework\TestCase; | |
final class Foo | |
{ | |
protected $bar; |
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\Rules; | |
use Illuminate\Contracts\Validation\Rule; | |
class ValidGmailAddress implements Rule | |
{ | |
/** | |
* Determine if the validation rule passes. |
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
<div x-data="tagSelect()" x-init="init('parentEl')" @click.away="clearSearch()" @keydown.escape="clearSearch()"> | |
<div class="relative" @keydown.enter.prevent="addTag(textInput)" @keydown.tab.prevent="addTag(textInput)"> | |
<input | |
id="{{ $id }}" | |
type="{{ $formtype ?? 'text' }}" | |
x-model="textInput" | |
x-ref="textInput" | |
@input="search($event.target.value)" | |
class="form-input block w-full transition duration-150 ease-in-out sm:text-sm sm:leading-5" | |
placeholder="{{ $placeholder ?? '' }}"> |
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 | |
// Expression to use && operator | |
$bool = TRUE && FALSE; | |
// Display the result of && operation | |
echo ($bool ? 'TRUE' : 'FALSE'); // Output: FALSE | |
// Expression to use AND operator | |
$bool = TRUE and FALSE; | |
// Display the result of AND operation |
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
<!-- Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) --> | |
<script type="text/javascript" async="true"> | |
(function() { | |
var host = window.location.hostname; | |
var element = document.createElement('script'); | |
var firstScript = document.getElementsByTagName('script')[0]; | |
var milliseconds = new Date().getTime(); | |
var url = 'https://quantcast.mgr.consensu.org' | |
.concat('/choice/', 'CUSTOM_ID', '/', host, '/choice.js') | |
.concat('?timestamp=', milliseconds); |
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
name: CD | |
on: | |
push: | |
branches: [ production ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: |
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
const mix = require("laravel-mix"); | |
const tailwindcss = require("tailwindcss"); | |
const rootPath = mix.paths.root.bind(mix.paths); | |
const tailwindPlugins = function (configFile, paths) { | |
const pluginList = [tailwindcss(configFile)]; | |
if (mix.inProduction()) { | |
pluginList.push( | |
require("@fullhuman/postcss-purgecss")({ |