Skip to content

Instantly share code, notes, and snippets.

@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active April 9, 2024 14:08
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@seanhandley
seanhandley / docker-compose.yml
Last active April 9, 2024 04:05
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@kentcdodds
kentcdodds / index.html
Last active June 24, 2021 19:48
The one true react boilerplate
<body>
<div id="⚛️"></div>
<script src="https://unpkg.com/react@16.0.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.0.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
<script type="text/babel">
ReactDOM.render(<div>Hello World!</div>, document.getElementById('⚛️'))
</script>
</body>
@jaymcgavren
jaymcgavren / home_dir_homebrew.sh
Last active July 27, 2022 23:56
Install Homebrew to your home directory. Great for running Homebrew as a guest user on a Mac.
git clone https://github.com/Homebrew/brew.git
export PATH=${HOME}/brew/bin:${PATH}
@ralphschindler
ralphschindler / README.md
Last active September 30, 2023 19:28
Docker For Mac Host Address Alias To Enable PHP XDebug (10.254.254.254 Trick)

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254.

Once your machine has a well known IP address, your PHP container will then be able to connect to it, specifically XDebug can connect to it at the configured xdebug.remote_host.

Installation Of IP Alias (This survives reboot)

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@imjared
imjared / bootstrap-breakpoints.scss
Last active August 16, 2016 10:13
scss breakpoint helpers based on bootstrap
// breakpoint helpers based on bootstrap's breakpoints
@mixin xs {
@media #{screen} and (max-width: #{$screen-xs-max}) {
@content;
}
}
@mixin sm {
@media #{screen} and (min-width: #{$screen-sm-min}) and (max-width: #{$screen-sm-max}) {
@jmar777
jmar777 / debugging-node-elastic-beanstalk-woes
Created February 28, 2014 22:32
Debugging "Failed to run npm install. Snapshot logs for more details." on Elastic Beanstalk
First, we need to figure out what the actual error is. This is obviously frustrating given that the error message is intentionally truncating it.
1) SSH in to your node (various guides available for this if you're not already familiar with this).
2) Run this command (basically an Elastic Beanstalk wrapper command for npm install I found in a blog post [1]):
$ sudo /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install 2
3) Find the actual error message in the output from the npm install.
Once you know the error, it should hopefully be fairly obvious how to fix it. I've run into two different errors over the last couple days on Elastic Beanstalk:
The first was a dependency that was using the new "^X.Y.Z" version syntax, which is only supported in Node >= v0.10.26 (whereas Elastic Beanstalk only supports up to v0.10.21 as of today). The solution here was easy: hardcode a dependency version *prior* to when that dependency adopted to the new syntax.