Skip to content

Instantly share code, notes, and snippets.

View joshua-chavanne's full-sized avatar
:octocat:
Git'n stuff done

joshua chavanne joshua-chavanne

:octocat:
Git'n stuff done
  • laudable info
  • oakland, ca
View GitHub Profile
@joshua-chavanne
joshua-chavanne / NormalizeMktoForms.css
Created October 19, 2018 19:54 — forked from cougrimes/NormalizeMktoForms.css
Marketo Form Normalizer--making things actually responsive.
.mktoForm, .mktoForm .mktoFieldWrap, .mktoForm .mktoHtmlText, .mktoForm input, .mktoLogicalField .mktoCheckboxList {width:100% !important;}
@media only screen and (min-width:480px) {
.mktoFormCol:first-child:nth-last-child(2), .mktoFormCol:first-child:nth-last-child(2) ~ .mktoFormCol {width: 100% !important;}
.mktoFormCol:first-child:nth-last-child(3), .mktoFormCol:first-child:nth-last-child(3) ~ .mktoFormCol {width: 50% !important;}
.mktoFormCol:first-child:nth-last-child(4), .mktoFormCol:first-child:nth-last-child(4) ~ .mktoFormCol {width: 33.3333% !important;}
.mktoFormCol:first-child:nth-last-child(3) ~ .mktoFormCol {padding-left: 0.3em !important;}
}
@media only screen and (max-width:480px) {.mktoFormCol {width:100% !important;}}
.mktoAsterix{display:none !important;}
.mktoForm .mktoGutter {display:none !important;}

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@joshua-chavanne
joshua-chavanne / optimize-images.sh
Created August 14, 2018 17:57 — forked from rkbhochalya/optimize-images.sh
Recursively optimize PNG and JPEG images using convert command
# Recursively optimize PNG and JPEG images using convert command
#
# `convert` is part of ImageMagick (http://www.imagemagick.org/). You will need to install it first.
#
# Author: Rajendra Kumar Bhochalya (http://rkb.io)
#
# @see https://developers.google.com/speed/docs/insights/OptimizeImages
# Optimize all JPEG images in current directory and subdirectories
find . -name "*.jpg" -exec convert "{}" -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB "{}" \; -exec echo "{}" \;
@joshua-chavanne
joshua-chavanne / GitHub-Forking.md
Created April 26, 2018 21:14 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@joshua-chavanne
joshua-chavanne / how-to-set-up-stress-free-ssl-on-os-x.md
Created January 15, 2018 08:20 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@joshua-chavanne
joshua-chavanne / checker.py
Created December 15, 2017 19:45
Simple Python Mailgun Upchecker to CRON
import requests
from datetime import datetime
myUrl = 'http://myurl/'
def send_simple_message(status):
myTime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
myText = "As of " + myTime + " the URL "+ myUrl +" is down with a status " + str(status)
return requests.post(
"API_URL",
@joshua-chavanne
joshua-chavanne / abtest-shortcode.php
Last active March 2, 2017 20:26
UTM Variable A/B Test Content Shortcode
<?php
function ab_tester_shortcode_callback($atts, $content = null){
$display = false;
$a = shortcode_atts(array(
'variant_key' => 'utm_variant',
'variant' => 'default',
'method' => 'GET'
),$atts);
@joshua-chavanne
joshua-chavanne / run_send_nsca.pl
Created March 2, 2017 00:51
Run and Send NSCA checks
#!/usr/bin/perl
use strict;
my $HOST="subdomain.hostname.com";
my $NSCA_HOST="NSCA HOST IP ADDRESS";
my $NSCA_CONFIG="/etc/send_nsca.cfg";
my $NSCA="/usr/sbin/send_nsca";
my $PLUGINS_PATH="/usr/lib/nagios/plugins/";
my $DISK_ARGS="-w 20% -c 10% -p ";
my $CHECK_ROOT="/usr/lib/nagios/plugins/check_disk ". $DISK_ARGS ."/";
my $CHECK_PROCS="/usr/lib/nagios/plugins/check_procs -w 250 -c 400 -s RSZDT";
#!/usr/bin/perl -w
#use strict;
#Author: Dennison Williams
use Nagios::Plugin;
use Data::Dumper;
use File::Basename;
my $pgrep = '/usr/bin/pgrep ';
my $netstat = '/usr/bin/sudo /bin/netstat -tnup --listening';
my $VERSION = '0.1';