Skip to content

Instantly share code, notes, and snippets.

View adampatterson's full-sized avatar
:octocat:

Adam Patterson adampatterson

:octocat:
View GitHub Profile
@adampatterson
adampatterson / 960gs.css
Created October 4, 2023 14:37
960.gs in Grid
.container_16 {
display: grid;
grid-template-columns: repeat(16, 50px [col-start]);
gap: 10px;
width: 960px;
margin-left: auto;
margin-right: auto;
}
/* Define grid column spans */
@adampatterson
adampatterson / index.html
Created May 19, 2023 02:23
Show hide navigation
<style>
.hide-header-mobile,
.hide-header {
width: 100%;
position: fixed;
transition: all .3s ease!important;
}
.hide-header-mobile {
display: none; /* Initially hide mobile menu */
@adampatterson
adampatterson / .editorconfig
Created September 13, 2022 14:36
Basic .editorconfig
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
@adampatterson
adampatterson / functions.php
Created March 26, 2021 22:37
Add SVG to Gravity from button - Elementor
add_filter( 'gform_submit_button', 'form_submit_button', 10, 2 );
function form_submit_button( $button, $form ) {
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="71.242" height="17.625" viewBox="0 0 71.242 17.625" class="javaVictorButton"><g id="button" transform="translate(-1095.422 -2403.444)"><path id="Path_535" data-name="Path 535" d="M-17503.5,2646.988h9.877l3.248-6.42,4.66,10.453,5.086-10.453,5.117,10.453,5.441-10.453h0l5.008,10.453,4.754-10.453,3.191,6.42h20.012" transform="translate(18598.922 -233.632)" fill="none" stroke="#fff" stroke-width="3"></path><path id="Path_536" data-name="Path 536" d="M-17295.016,2609l9.115,7.709-9.115,6.06" transform="translate(18450.072 -202.949)" fill="none" stroke="#fff" stroke-width="3"></path></g></svg>';
return "<button class='elementor-button-link elementor-button elementor-size-md' id='gform_submit_button_{$form['id']}'>
<span class='elementor-button-content-wrapper'>
<span class='elementor-button-icon elementor-align-ic
@adampatterson
adampatterson / injecter.js
Created October 10, 2019 17:55
Insert query param into form field.
// https://www.website.com/?service_code=secretcode
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)')
.exec(window.location.search);
return (results !== null) ? results[1] || 0 : false;
}
// Gravity form field ID
@adampatterson
adampatterson / listingpro-yoast.php
Created November 4, 2017 05:06
Listing Pro Google Address field.
function get_listingpro_meta(){
$meta = get_post_custom_values('lp_listingpro_options');
return unserialize($meta[0]);
}
function get_listingpro_address($test) {
$listing_meta = get_listingpro_meta();
@adampatterson
adampatterson / sample.php
Created October 18, 2017 00:50
Whoops PHP Storm Config
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
@adampatterson
adampatterson / .babelrc
Created June 22, 2017 19:47
Using Mix to build React, Includes Object Spread
{
"plugins": [
"transform-object-rest-spread",
"transform-class-properties",
"transform-react-constant-elements",
"transform-decorators-legacy"
],
"presets": [
["es2015", {"modules": false}],
"react"
@adampatterson
adampatterson / wp-multisite-cron.php
Last active January 25, 2017 20:56
Call WordPress CRONs properly, removes event based cron functionality.
<?php
/*
* Since WordPress is event driven, the wp-cron's will run on every single page load.
* This means if you have a larger WordPress site your doing a lot of extra leg work for noreason.
* This fixes that on Multsites
*
* Add this file to the root of your WordPress site and then add define('DISABLE_WP_CRON', 'true');
* to your wp-config.php
*
* Make sure that you create a true CRON job that will call your site URL via curl
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;