Skip to content

Instantly share code, notes, and snippets.

View beatwiz's full-sized avatar
🥶
#crunching

Gustavo Silva beatwiz

🥶
#crunching
View GitHub Profile
@BenCavens
BenCavens / DatabaseQueueMonitorCommand.php
Created August 2, 2021 08:28
Laravel queue monitoring on shared hosting
<?php
namespace App\Queue;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class DatabaseQueueMonitorCommand extends Command
{
@regalstreak
regalstreak / PC Style Shortcuts.bttpreset
Last active August 20, 2020 12:41
BetterTouchTool - Windows Style Keyboard Shortcuts
{
"BTTPresetName" : "PC Style Shortcuts",
"BTTPresetColor" : "0.000000, 192.718165, 255.000000, 255.000000",
"BTTPresetUUID" : "B408D1DD-F0EE-45B7-BAD8-A60A298DE23C",
"BTTPresetContent" : [
{
"BTTActivationGroupName" : "All Except",
"BTTAppName" : "All Except",
"BTTAppAutoInvertIcon" : 1,
"BTTAppProcessMatchMode" : 3,
@yojona
yojona / countries_codes_and_coordinates.json
Last active December 4, 2020 17:04 — forked from tadast/countries_codes_and_coordinates.csv
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude
[
{
"country": "Afghanistan",
"alpha_2_code": "AF",
"alpha_3_code": "AFG",
"numeric_code": 4,
"latitude": 33,
"longitude": 65
},
{
@nicomollet
nicomollet / acf-disable-autocomplete.php
Created July 26, 2018 15:03
ACF Disable Autocomplete on input and textarea fields
<?php
/**
* ACF Disable Autocomplete on input and textarea fields
* Chrome ignores autocomplete="off" in some cases
*
* @author Nicolas Mollet
* @link https://bugs.chromium.org/p/chromium/issues/detail?id=468153
*/
function acf_input_disable_autocomplete() {
@mpryvkin
mpryvkin / beautify-html.js
Last active August 6, 2020 15:46 — forked from brnpimentel/beautify-html.js
JS Beautify hack to work with Blade directives (Laravel)
function Beautifier(html_source, options, js_beautify, css_beautify) {
//Wrapper function to invoke all the necessary constructors and deal with the output.
html_source = html_source || '';
// BEGIN
html_source = html_source.replace(/\{\{((?:(?!\}\}).)+)\}\}/g, function (m, c) {
if (c) {
c = c.replace(/(^[ \t]*|[ \t]*$)/g, '');
c = c.replace(/'/g, '&#39;');
c = c.replace(/"/g, '&#34;');
@jsn789
jsn789 / add-gtm-wp.php
Last active September 4, 2024 13:38
Add Google Tag Manager through functions.php in WordPress
/* Add Google Tag Manager javascript code as close to
the opening <head> tag as possible
=====================================================*/
function add_gtm_head(){
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
@edheltzel
edheltzel / php-server-with-wordpress.md
Last active November 26, 2020 21:33
Using PHP's built in server for WordPress development.

Preface

So in the past, I've used MAMP/MAMP Pro apps and others alike. I've also, setup my own local MAMP stack with homebrew, that used dnsmasq to dynamically add vhosts anytime I added a new folder to the Sites folder which made it very convenient. But, then I started running into other environment issues with PHP versions on remote machines/servers not being updated or some other crazy thingamabob breaking. I researched and invested time in Vagrant, but that seem to break more often than my homebrew setup. So I researched again investing time into Docker via Docker for Mac (which is BAMF), which I'm sold on and use daily, but it still seems a little bleeding edge and not so simple to wrap your head around the concept. Not to mention I don't have a real use case to play with and take advantage of all the features that come packed with Docker.

This is the beginning of trying to find something more simple, and slightly quicker to setup.

@davidrushton
davidrushton / Kernel.php
Created February 17, 2016 17:29
Laravel 5 Database Queue - Shared Hosting
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
@mattclements
mattclements / function.php
Last active October 29, 2024 22:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@juyal-ahmed
juyal-ahmed / wp-featured-image-upload-for-front-end.php
Last active February 21, 2018 03:48
Upload featured image on custom post from WordPress front-end