Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Enrique Chavez Tmeister

🏠
Working from home
View GitHub Profile
@Tmeister
Tmeister / blade-heroicons.md
Created Sep 30, 2021
Adding the blade-heroicons package to Sage 10
View blade-heroicons.md
View OnboardingTest.php
<?php
test('a register user should see the onboarding page and update the data', function () {
$user = User::create([
'uuid' => Str::random(12),
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'john@doe.com',
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
]);
@Tmeister
Tmeister / wp-config.php
Created Aug 12, 2021
WordPress response to different domains
View wp-config.php
<?php
if(isset($_SERVER['HTTP_HOST'])){
define('CUSTOM_REQUEST_URL', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', CUSTOM_REQUEST_URL);
define('WP_HOME', CUSTOM_REQUEST_URL);
}
/* That's all, stop editing! Happy publishing. */
@Tmeister
Tmeister / gist:aaefe1019900d1d91b498090f9305ee3
Created Aug 11, 2021
Fix Files and Folder Permissions WordPress
View gist:aaefe1019900d1d91b498090f9305ee3
chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
@Tmeister
Tmeister / functions.php
Last active Mar 16, 2021
Make zipcode optional on WooCommerce
View functions.php
<?php
add_filter( 'woocommerce_default_address_fields' , function($fields){
$fields['postcode']['required'] = false;
return $fields;
});
View generate.php
<?php
namespace App\Jobs;
use App\Lead;
use Cache;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
@Tmeister
Tmeister / app.js
Created Oct 30, 2019
Add CSRF to axios
View app.js
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
const token = document.head.querySelector( 'meta[name="csrf-token"]' );
if ( token ) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
View LineChart.vue
<script>
import { Line, mixins } from 'vue-chartjs';
const { reactiveProp } = mixins;
export default {
extends: Line,
mixins: [reactiveProp],
props: {
chartdata: Object,
View wp-config.php
<?php
define('SP_REQUEST_URL', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', SP_REQUEST_URL);
define('WP_HOME', SP_REQUEST_URL);