Skip to content

Instantly share code, notes, and snippets.

View getdave's full-sized avatar

Dave Smith getdave

View GitHub Profile
@aduth
aduth / gitrebasebranch.sh
Created February 11, 2020 17:05
Git - Interactive rebase against own merge base
#!/bin/bash
git rebase -i $(git merge-base HEAD master)
@xrstf
xrstf / letsencrypt.md
Last active October 30, 2024 07:03
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

# A Liquid tag for random number generation
# Usage: {% random min:max %} where min and max are integers and min < max
module Jekyll
class Random < Liquid::Tag
def initialize(tag_name, range, tokens)
super
limits = range.split(":")
@min = limits[0].to_i
@hdragomir
hdragomir / sm-annotated.html
Last active October 9, 2024 00:35
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@corradomatt
corradomatt / SSL and WooCommerce Exclude for Migrate DB Pro
Last active November 23, 2020 18:39
The settings for Migrate-DB-Pro plugin to exclude Better WordPress Security, WooCommerce SSL and WooCommerce Plugin Activation settings when pushing or pulling your database. This code DOES NOT work as a stand-alone gist. You will need to utilize it within this code - https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks/
/**
* Exclude certain WordPress database settings from being migrated when pushing or pulling
* with Migrate-DB-Pro
*
* Useful when developing locally and wanting to push or pull database settings between envirnments
* USE CAUTION! - Must be used with https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks/
*/
function preserved_options( $options ) {
$options[] = 'blog_public'; // discourage search engines setting
$options[] = 'bit51_bwps'; // Better WordPress Security Settings
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@getdave
getdave / pre-commit.sh
Created September 25, 2013 16:15
Git Pre-Commit hook bash script to stop people committing directly to the master branch. Typically useful in a GitFlow based workflow. Installation would be as simple as ```` ln -s ../../pre-commit.sh .git/hooks/pre-commit ````
git branch | grep "* master" && echo 'COMMIT REJECTED - you are not allowed to commit directly to the master branch you fool!'
@justintadlock
justintadlock / register-post-type.php
Last active October 20, 2024 13:47
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@hubgit
hubgit / app.js
Last active December 16, 2015 21:39
Postcode -> Location lookup using Ordnance Survey Linked Data APIs
$(function() {
var form = $("form");
var button = form.find("button[type=submit]");
var input = form.find("input[name=postcode]");
var output = form.find("output[name=location]");
var map = L.mapbox.map("map", "hubbox.map-u557d78b").setView([54, 0], 6);
var failed = function(data) {
button.html("Failed");
@wpscholar
wpscholar / functions.php
Last active October 20, 2024 14:01
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/