Skip to content

Instantly share code, notes, and snippets.

View RiFi2k's full-sized avatar

Reilly Lowery RiFi2k

View GitHub Profile
@corsonr
corsonr / gist:dedfa5ca719488291170
Created November 27, 2015 09:25
Delete WooCommerce Orphaned Variations
DELETE o FROM `wp_posts` o
LEFT OUTER JOIN `wp_posts` r
ON o.post_parent = r.ID
WHERE r.id IS null AND o.post_type = 'product_variation'
@X3MBoy
X3MBoy / nano-shorts.md
Created April 28, 2017 20:27 — forked from franz-josef-kaiser/nano-shorts.md
nano keyboard shortcuts

^ = Ctrl key M = Alt key

^G      (F1)            Display this help text
^X      (F2)            Close the current file buffer / Exit from nano
^O      (F3)            Write the current file to disk
^J      (F4)            Justify the current paragraph

^R      (F5)            Insert another file into the current one
@conorbarclay
conorbarclay / GoogleMap.js
Last active August 19, 2018 07:41
WordPress + Google Map Workflow (using ACF field data)
/* global google */
import $ from 'jquery';
class GoogleMap {
constructor(el) {
this.el = $(el);
this.icon = {
path: 'M25,0C15.957,0,8.625,7.277,8.625,16.253C8.625,31.638,25,50,25,50s16.375-17.37,16.375-33.747 C41.375,7.277,34.044,0,25,0z M25,23.084c-3.383,0-6.125-2.742-6.125-6.125s2.742-6.125,6.125-6.125s6.125,2.742,6.125,6.125 S28.383,23.084,25,23.084z',
fillColor: '#ed1c2e',
fillOpacity: 1,
location ~ ^(.*)\/wp-content\/uploads\/(.*)$ {
try_files $uri @missing;
}
location @missing {
rewrite "^(.*)/wp-content/uploads/(.*)$" "http://production-url.com$1/wp-content/uploads/$2" redirect;
}
import debounce from "lodash/debounce"
let localStorageAvailable = () => {
let test = 'test';
try {
localStorage.setItem(test, test);
localStorage.removeItem(test);
return true;
} catch(e) {
return false;
@pradipchitrakar
pradipchitrakar / decrypt.js
Last active November 4, 2021 19:07
AES Encrypt data in php and decrypt in node js.
//require cyrpto module
var crypto=require('crypto');
//key and iv should be same as the one in encrypt.php
var decipher=crypto.createDecipheriv('aes-256-cbc','12345678901234561234567890123456','1234567890123456');
//since we have already added padding while encrypting, we will set autopadding of node js to false.
decipher.setAutoPadding(false);
// copy the output of encrypt.php and paste it below
@eugenoprea
eugenoprea / functions.php
Last active December 8, 2022 11:37
Gravity Forms - Checkbox Dynamic Population
// When true, the form will be saved to DB after dynamic population
define('EO_SAVE_FORM_ON_PRE_RENDER', true);
// Adds a filter to form id 7. Replace 26 with your actual form id
add_filter('gform_pre_render_7', 'eo_populate_checkbox');
add_filter('gform_admin_pre_render_7', 'eo_populate_checkbox');
function eo_populate_checkbox($form) {
if (EO_SAVE_FORM_ON_PRE_RENDER)
@davidgilbertson
davidgilbertson / http2.js
Last active October 9, 2023 06:09
HTTP2 server with compression and caching
const http2 = require('http2');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const brotli = require('brotli'); // npm package
const PORT = 3032;
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/');
const cache = {};
@cristianstan
cristianstan / Simple Ajax Login Form.php
Last active October 12, 2023 00:09
Wordpress: Simple Ajax Login Form
<?php
//Simple Ajax Login Form
//Source: http://natko.com/wordpress-ajax-login-without-a-plugin-the-right-way/
?>
//html
<form id="login" action="login" method="post">
<h1>Site Login</h1>
<p class="status"></p>
<label for="username">Username</label>
@spivurno
spivurno / gist:6584835
Created September 16, 2013 18:51
Gravity Forms Cookies // Saves the query string parameters from a users visit to a cookie and allows these values to be populated via Gravity Forms' Dynamic
<?php
/**
Plugin Name: Gravity Forms Cookies
Plugin URI: http://ounceoftalent.com/
Description: Saves the query string parameters from a users visit to a cookie and allows these values to be populated via Gravity Forms' Dynamic Population feature.
Version: 1.5
Author: David Smith
Author URI: http://ounceoftalent.com
License: GPL2
*/