Skip to content

Instantly share code, notes, and snippets.

View Tmeister's full-sized avatar
🇲🇽
Working from home

Enrique Chavez Tmeister

🇲🇽
Working from home
View GitHub Profile
@Tmeister
Tmeister / blade-heroicons.md
Last active November 5, 2021 18:18
Adding the blade-heroicons package to Sage 10
<?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 August 12, 2021 14:35
WordPress response to different domains
<?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 August 11, 2021 16:44
Fix Files and Folder Permissions WordPress
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 March 16, 2021 21:34
Make zipcode optional on WooCommerce
<?php
add_filter( 'woocommerce_default_address_fields' , function($fields){
$fields['postcode']['required'] = false;
return $fields;
});
<?php
/**
* Proof of Concept
*/
$settings = [
[
'id' => 1,
@Tmeister
Tmeister / generate.php
Created February 18, 2020 00:57
Jobs process
<?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 October 30, 2019 16:59
Add CSRF to axios
/**
* 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 {
<script>
import { Line, mixins } from 'vue-chartjs';
const { reactiveProp } = mixins;
export default {
extends: Line,
mixins: [reactiveProp],
props: {
chartdata: Object,
<?php
define('SP_REQUEST_URL', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', SP_REQUEST_URL);
define('WP_HOME', SP_REQUEST_URL);