This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable XMLRPC | |
<Files xmlrpc.php> | |
Order Allow,Deny | |
Deny from all | |
</Files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Postman Pre-Request script to append CSRF token in header for POST requests in Laravel | |
* Sanctum authenticated SPA. Requires active environment with {{url}} variable defined | |
* for main app domain. | |
* | |
* Postman Interceptor allows appending cookies from browser, but Laravel CSRF middleware | |
* only validates CSRF in headers or in _token form field, not in cookies. Axios automatically | |
* appends the CSRF from cookie to headers, but Postman cannot access intercepted cookies | |
* and use them, so we have to do one pre-request to get the CSRF token, store it | |
* in environment so it can be reused, and then append it to headers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Set the composite keys for a save update query. | |
* | |
* @param \Illuminate\Database\Eloquent\Builder $query | |
* @return \Illuminate\Database\Eloquent\Builder | |
*/ | |
protected function setKeysForSaveQuery(Builder $query) | |
{ | |
$query | |
->where('user_id', '=', $this->getAttribute('user_id')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Traits; | |
/** | |
* Allows saving models without triggering observers | |
*/ | |
trait SaveQuietly | |
{ | |
/** | |
* Save model without triggering observers on model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// theme | |
add_action( 'wp_enqueue_scripts', function() { | |
if ( ! is_admin() ) { | |
$version = wp_get_theme()->get( 'Version' ); | |
wp_enqueue_style( 'child-theme', trailingslashit( get_stylesheet_directory_uri() ) . 'style.css', [], $version, 'all' ); | |
} | |
}); | |
// plugin | |
add_action( 'wp_enqueue_scripts', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Logs output into wp-content/logs/asana-api-debug.log | |
*/ | |
protected function log($message) | |
{ | |
$line = '[' . date('Y-m-d H:i:s') . '] ' . $message . "\n"; | |
file_put_contents($this->logFile, $line, FILE_APPEND); | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('error_reporting', E_ERROR); | |
register_shutdown_function("fatal_handler"); | |
function fatal_handler() { | |
$error = error_get_last(); | |
echo("<pre>"); | |
print_r($error); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect from non-www or http to https www | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# exclude acme challenge urls from rewriting to not mess Let's Encrypt | |
RewriteRule ^\.well-known\/acme-challenge\/ - [L] | |
RewriteCond %{HTTP_HOST} !^www\. [NC,OR] | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://www.jandhqualitykitchens.com.au/$1 [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ignore everything | |
# Only keep child theme and skin | |
# has to be written in this stupid way for git to handle ignores in subdirectories correctly | |
# ignore all | |
/* | |
#keep gitignore | |
!/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* IE 10, 11 fixes | |
*/ | |
// general fixes | |
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { | |
} | |
// bound with media queries |
NewerOlder