Skip to content

Instantly share code, notes, and snippets.

View jrmadsen67's full-sized avatar
💭
Looking for new remote opportunities

Jeff Madsen jrmadsen67

💭
Looking for new remote opportunities
View GitHub Profile
@coderabbi
coderabbi / gist:79b9879b123f450521248886466f6a00
Last active January 7, 2017 08:11
processModelsMappedFromFormRequest()
Collection::macro('transpose', function () {
$items = array_map(function (...$items) {
return $items;
}, ...$this->values());
return new static($items);
});
public function store(Request $request)
{
<?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
How to configure phpStorm with EditorConfig and PHPMD:
-----------------------------------------------------
PHPMD:
------
phpmd (PHP Mess Detector) is a static analysis tool that will find issues in your code you never knew you had. Your code will still run, follow a few of phpmd's recommendations though and it will be better!
phpmd is already bundled and enabled in phpstorm, but in order to more easily manage versions and add custom rulesets, you should do the following:
@petersuhm
petersuhm / AppServiceProvider.php
Last active August 29, 2015 14:27
Bind a class to current authenticated object in a multi tenant app.
<?php
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
@benmay
benmay / gist:222db7df6aecedb2c5e7
Created June 4, 2014 23:55
Get files from prod if they don't exist on local dev / staging. Put this snippet BEFORE the WordPress rule in htaccess.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*) http://PRODUCTION_SERVER/wp-content/uploads/$1 [NC,L]
</IfModule>
anonymous
anonymous / PHP.sublime-build
Created November 9, 2013 10:46
Executes PHP files with Sublime Text build system. Requires to have the PHP binary in your PATH.
{
"shell_cmd": "php \"${file}\"",
"working_dir": "${file_path}",
"selector": "source.php"
}
@joostvanveen
joostvanveen / get_key.php
Created November 13, 2012 08:30
Helper function that returns the value for a key in an array or a property in an object. No more endless isset() statements.
<?php
/**
* Return the value for a key in an array or a property in an object.
* Typical usage:
*
* $object->foo = 'Bar';
* echo get_key($object, 'foo');
*
* $array['baz'] = 'Bat';
* echo get_key($array, 'baz');
@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.