Skip to content

Instantly share code, notes, and snippets.

View hotmeteor's full-sized avatar
👾

Adam Campbell hotmeteor

👾
View GitHub Profile
@hofmannsven
hofmannsven / .env.github
Last active January 28, 2024 18:34
Notes on working with GitHub Actions and Laravel Nova.
APP_ENV=ci
APP_KEY=
APP_DEBUG=true
APP_URL=https://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=33306
@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',
@kevyworks
kevyworks / prep-ncv-env.sh
Last active April 14, 2022 15:54
Prepare Dev Machine for: Node Composer & Laravel Valet
# MOJAVE: https://gist.github.com/kevmt/476716bfb0383d3fda699e4fcacc6470
# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Terminal Aliases
echo "alias artisan='php $PWD/artisan'" >> ~/.bash_profile
echo "export NVM_DIR=~/.nvm" >> ~/.bash_profile
echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.bash_profile
@ryanscherler
ryanscherler / php-openssl.md
Last active August 16, 2018 20:06
Use Homebrew PHP with OpenSSL instead of SecureTransport
@levymetal
levymetal / app.component-partial.ts
Last active November 1, 2022 02:47
How to show the keyboard accessory bar in Ionic 2.0.0-rc.1. Full blog post here: http://christianvarga.com/how-to-show-the-ios-keyboard-accessory-bar-in-ionic-2-0-0-rc-1/
import { StatusBar, Splashscreen, Keyboard } from 'ionic-native';
#!/bin/sh
temporaryPath="$(mktemp -t php-no-debug.XXXX)"
find /etc/php5/cli/php.ini /etc/php5/cli/conf.d/*.ini ! -name 20-xdebug.ini | xargs cat > "$temporaryPath"
/usr/bin/php -n -c "$temporaryPath" "$@"
rm -f "$temporaryPath"
@reinink
reinink / example.php
Last active October 23, 2020 15:45
Given multiple periods of time in a day, that may overlap, calculate the sum of all the periods, in hours.
<?php
$periods = [
[new DateTime('8AM'), new DateTime('5PM')], // 9 hours
[new DateTime('8AM'), new DateTime('5PM')], // 9 hours
[new DateTime('10AM'), new DateTime('12PM')], // 2 hours
[new DateTime('12PM'), new DateTime('5PM')], // 5 hours
[new DateTime('7PM'), new DateTime('8PM')], // 1 hour
[new DateTime('9AM'), new DateTime('4PM')], // 7 hours
];
@frankdejonge
frankdejonge / example.php
Created July 20, 2015 12:05
Concurrent upload to S3 buckets with Flysystem and pthreads
<?php
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;
function get_filesystem() {
$client = new S3Client([
'credentials' => [
'key' => getenv('AWS_KET'),
@bkuhl
bkuhl / ClasspathToClassConstants.md
Last active February 20, 2016 16:08
Find/replace full classpaths to use php ::class constants

Purpose: Replaces all ::mock and ::make instances with PHP class constants.

This is useful when upgrading Laravel 4 projects to Laravel 5.

Note: This find/replace assumes all mock/make instances utilize full classpaths (e.g. App::make('My\Project\Namespace\MyClass'))

Text to find:

\:\:(mock|make)\('(.+?)'\)
@davatron5000
davatron5000 / blur-validate.js
Created May 28, 2015 19:34
HTML5 Validation on blur()
var inputs = document.querySelectorAll('input, textarea');
for(var i=0;i<inputs.length;i++) {
inputs[i].addEventListener('blur', function(){
if(!this.checkValidity()) {
this.classList.add('has-error');
} else {
this.classList.remove('has-error');
}
});
}