Skip to content

Instantly share code, notes, and snippets.

@elconejito
elconejito / gf_query2hidden.js
Created November 1, 2017 16:11
Gravity Forms - Fill in hidden fields with data from URL Query Parameters such as UTM_*
/**
* This function parses the URL for a given parameter and returns the value of that parameter
*/
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
@elconejito
elconejito / Disable WP Comments
Created September 1, 2016 15:23
Update all posts to not have comments enabled.
SELECT ID, comment_status, ping_status, post_type FROM wp_posts WHERE post_type IN ('post','page');
UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed' WHERE post_type IN ('post','page');
@elconejito
elconejito / Hax Commands
Last active July 27, 2016 17:40
Remove annoyances in my dev environment
DISABLE STRICT HOST KEY CHECKING
============
Open or create this file: ~/.ssh/config
Add this to the file, where * is a domain you trust
-----------
Host *
StrictHostKeyChecking no
Then run this for "security": sudo chmod 400 ~/.ssh/config
@elconejito
elconejito / Sizes.txt
Last active May 9, 2016 22:07
GF Styles for Old&Busted sites that need inline form styles.
gf_ten
gf_twenty
gf_twentyfive
gf_thirty
gf_thirtythree
gf_forty
gf_fifty
gf_sixty
gf_sixtysix
gf_seventy
@elconejito
elconejito / gulpfile.js
Last active April 4, 2016 19:48
Favorite Gulpfile.js, stolen mostly from https://github.com/roots/sage
// ## Globals
var argv = require('minimist')(process.argv.slice(2));
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
var changed = require('gulp-changed');
var concat = require('gulp-concat');
var flatten = require('gulp-flatten');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
@elconejito
elconejito / Current Favorite NPM packages
Created March 11, 2016 17:11
Object for package.json with my current favorite devDependencies. Mostly taken from Roots/Sage package.json
"devDependencies": {
"asset-builder": "^1.1.0",
"browser-sync": "^2.8.2",
"del": "^1.2.1",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-changed": "^1.3.0",
"gulp-concat": "^2.6.0",
"gulp-cssnano": "^2.1.0",
"gulp-flatten": "0.1.1",
@elconejito
elconejito / wp-config-local.php
Created February 29, 2016 15:17
Sample wp-config-local.php for use in local development of Panthon sites.
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
@elconejito
elconejito / wp-config.php
Last active June 27, 2016 14:30
Manually set the site's domain name in wp-config.php when using Pantheon. This will force the url to always be the same, no matter what is in HTTP_HOST
// Redirect to SSL always
if ( ($_SERVER['PANTHEON_ENVIRONMENT'] === 'live') && (php_sapi_name() != "cli")) {
if ($_SERVER['HTTP_HOST'] != '{sitename}' || !isset($_SERVER['HTTP_USER_AGENT_HTTPS']) || $_SERVER['HTTP_USER_AGENT_HTTPS'] != 'ON' ) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: https://{sitename}'. $_SERVER['REQUEST_URI']);
exit();
}
}
/** A couple extra tweaks to help things run well on Pantheon. **/
if (isset($_SERVER['HTTP_HOST'])) {
@elconejito
elconejito / gulp-zip for wordpress
Created February 20, 2015 17:23
This is a partial for a gulp file to zip up a folder conforming to WordPress requirements.
var gulp = require('gulp'),
zip = require('gulp-zip'),
pkg = require('./package.json');
var zipDirs = [
'*.*',
'foldertoinclude/**',
'!filetobeignored.txt'
];