Skip to content

Instantly share code, notes, and snippets.

View stillatmylinux's full-sized avatar

Matt Thiessen stillatmylinux

View GitHub Profile
@stillatmylinux
stillatmylinux / AppServiceProvider.php
Created February 5, 2020 19:13
How to make the Controller name, action and view path available to the view.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
@stillatmylinux
stillatmylinux / laravel-production-permissions.md
Created October 23, 2019 20:05 — forked from barbietunnie/laravel-production-permissions.md
MySQL Database User GRANT permissions for Laravel

MySQL Database User GRANT permissions for Laravel

For security reasons, you should probably grant select, delete, update and insert to your app user in production.

Have another user who can do alter, create, drop and index when running migrations.

If you run seeders in production, also grant select, insert and references to the migration user.

Yeah, 2 users, migrations are not always run in production everyday and this keeps more secure your database.

@stillatmylinux
stillatmylinux / laravel-production-permissions.md
Created October 23, 2019 20:05 — forked from barbietunnie/laravel-production-permissions.md
MySQL Database User GRANT permissions for Laravel

MySQL Database User GRANT permissions for Laravel

For security reasons, you should probably grant select, delete, update and insert to your app user in production.

Have another user who can do alter, create, drop and index when running migrations.

If you run seeders in production, also grant select, insert and references to the migration user.

Yeah, 2 users, migrations are not always run in production everyday and this keeps more secure your database.

<?php
/**
* Overwrites the push notification title only for iOS for the AppPush plugin when sending
* push notification for a regular post.
*
* Place this file in the wp-content/mu-plugins folder.
* The mu-plugins folder is not there by default, you may have to create it.
*/
/**
* Submit image URL and attachment_id to WordPress
*
* Custom js to be uploaded in the MyApppresser customizer
*/
(function(window, document) {
window.document.addEventListener('appcamera-uploadwin', imageUploaded);
function imageUploaded(event) {
// Angular 2
let options: any = {};
if(nocache) {
let headersAdditional: Headers = new Headers();
headersAdditional.append('Cache-control', 'no-cache');
headersAdditional.append('Content-type', 'application/json');
options = new RequestOptions({ headers: headersAdditional });
}
<?php
$consumer_key = '';
$consumer_secret = '';
// If the $_GET parameters are present, use those first.
if ( ! empty( $_GET['consumer_key'] ) && ! empty( $_GET['consumer_secret'] ) ) {
$consumer_key = $_GET['consumer_key']; // WPCS: sanitization ok.
$consumer_secret = $_GET['consumer_secret']; // WPCS: sanitization ok.
}
# BEGIN AppCommerce Plugin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
# END AppCommerce Plugin
<?php
// Add this file to your wp-content/mu-plugins/add-login-role.php
/**
* Adds a user role to the AppPresser login data
*/
function appp_login_data_add_role( $login_data, $user_id ) {
// Add your own logic to set which role you want to add
<div *ngIf="user?.role=='admin'">You are an admin</div>
<div *ngIf="user?.role=='member'">You are a member</div>
<div *ngIf="user?.role==''">Hello user</div>
<div *ngIf="!user">Hello stranger</div>