Skip to content

Instantly share code, notes, and snippets.

View cbj4074's full-sized avatar

Ben Johnson cbj4074

View GitHub Profile
@VeryStrongFingers
VeryStrongFingers / php-phpdbg-proxy.sh
Last active June 29, 2020 06:53
PHPStorm - PHP-PHPDBG Interpreter proxy
#!/bin/bash
#### Dirty/Fake PHP Interpreter to trick PHPStorm into using PHPDBG for running tests with/without code coverage
## For Mac/Linux only, Window's ubuntu subsystem theoretically would work too
##
## JETBRAINS IMPLEMENTED THE FEATURE REQUEST. No need to use this script anymore.
##
##
## Related JetBrain's issues/feature requests
## https://youtrack.jetbrains.com/issue/WI-21414
@roquie
roquie / AuthServiceProvider.php
Created July 27, 2018 14:53
Laravel 5.6 Cartalyst Sentinel Integration
<?php
declare(strict_types=1);
namespace App\Providers;
use Auth;
use Domain\SentinelGuard;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
@hewerthomn
hewerthomn / install_oci8_ubuntu_16.04_php7.1.md
Created February 22, 2017 14:45
How to install OCI8 on Ubuntu 16.04 and PHP 7.1
@AtulKsol
AtulKsol / psql-error-fix.md
Last active August 17, 2024 21:55
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

GitHub-flavored Markdown does not use C-style escapes for escaping backticks inside spans. Instead, GFM uses double, significant whitespaced, backticks.

Two backticks, then a space, then a backtick, then a space, then two more backticks:

`` ` ``

produces:

@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active October 31, 2024 13:38
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@jrmadsen67
jrmadsen67 / gist:bd0f9ad0ef1ed6bb594e
Last active August 19, 2024 10:37
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@brandonferens
brandonferens / UpgradeToSentinel.php
Last active November 14, 2021 16:43
A Laravel 5 console command to upgrade the database from Cartalyst Sentry to Sentinel. The migrations are at the bottom of the file. Make sure to pull those out and use them instead of the default Sentinel migrations.
<?php namespace Potentia\Console\Commands;
use Activation;
use DB;
use Illuminate\Console\Command;
use Sentinel;
class UpgradeToSentinel extends Command
{
@gsherwood
gsherwood / ruleset.xml
Created December 5, 2014 20:06
PSR2 with tabs instead of spaces
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>PSR2 with tabs instead of spaces.</description>
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
@xf1
xf1 / remux
Created April 29, 2014 04:41
Remuxing with eac3to
Remuxing
Why Remux Blu-rays?
-You use MPC-HC (or similar DShow players) and standard filters for playback. You can also use better quality renderers like Haali, EVR and madVR.
-You get the ease of playback of a re-encode without the quality loss. A double click off the .mkv will start the movie - no annoying warnings, loading screens, previews and setup menus.
-You don't have to deal with horribly bloated, unstable and expensive PowerDVD or Arcsoft playback software.
-You don't have to mess with ISO creation, correct BD folder structure, UDF and SPTD drivers, and image mounting every time you want to watch a movie.
-You never have to worry about the region code setting of a disc.
-You never have to worry about HDCP or PAP content protection.
-You never have to worry about your software player downsampling your audio - get full bit-depth and frequency resolution, 24bit/96kHz or higher, not 16/48.