Skip to content

Instantly share code, notes, and snippets.

View jasondevine's full-sized avatar
:octocat:
Getting there

jasondevine

:octocat:
Getting there
View GitHub Profile
@jasondevine
jasondevine / mailchimpform.html
Created July 18, 2020 23:02 — forked from akashnimare/mailchimpform.html
Mailchimp newsletter signup form using ajax ❤️ Demo- http://codepen.io/akashnimare/full/XMozEo/
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mailchimp Signup form</title>
<meta name="description" content="Mailchimp Signup form using Ajax.">
<style type="text/css">
body {
background-image: linear-gradient(120deg, rgb(209, 219, 233), rgb(240, 250, 243));
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 'Helvetica Neue', Arial, sans-serif;
@jasondevine
jasondevine / sublimetext_over_ssh.md
Last active June 14, 2020 16:38
How to setup and run Sublime Text over SSH, so that you don't have to rely on nano or vi or some such

Technique for opening files on remote server with Subl:

Run this on local machine: Install the rsub package in Sublime Text using the Sublime Package Manager printf "Host *\n RemoteForward 52698 127.0.0.1:52698" >> ~/.ssh/config ..... this adds the port needed by rsub

Execute this on remote server: sudo wget -O /usr/local/bin/subl https://raw.github.com/aurora/rmate/master/rmate; sudo chmod +x /usr/local/bin/subl

@jasondevine
jasondevine / print_array.php
Created January 27, 2019 20:52
This is one way to print out the contents of an array for debugging or whatever
<?php echo '<pre>'; print_r($array); echo '</pre>'; ?>
/*
* Replacement for get_adjacent_post()
*
* This supports only the custom post types you identify and does not
* look at categories anymore. This allows you to go from one custom post type
* to another which was not possible with the default get_adjacent_post().
* Orig: wp-includes/link-template.php
*
* @param string $direction: Can be either 'prev' or 'next'
* @param multi $post_types: Can be a string or an array of strings
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&&
/**
* Multiple select customize control class.
*/
class Jayj_Customize_Control_Multiple_Select extends WP_Customize_Control {
/**
* The type of customize control being rendered.
*/
public $type = 'multiple-select';
@jasondevine
jasondevine / using-wpquery-class.php
Last active February 21, 2021 00:44
Here's a basic skeleton for a loop called using the WP_Query class. You could use this to display a secondary loop on the homepage, for example, a block featuring specific categories.
<?php
$args = array(
// arguments for your query
);
// the query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post() ;
// contents of the Loop go here
@jasondevine
jasondevine / responsive-background-image.php
Created March 6, 2017 15:09 — forked from thebeckyhamm/responsive-background-image.php
WordPress Responsive Background Images
/**
* Responsive Featured Image Background - used to set custom responsive background on each page. I should probably turn this into a plugin at some point.
* Based on the work by Steven Slack: @link http://s2webpress.com//responsive-featured-image-function-in-wordpress-themes/
*
*/
function my_featured_image() {
// call the global post variable
global $post;
@jasondevine
jasondevine / nginx.conf
Created January 26, 2017 10:47 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which