Skip to content

Instantly share code, notes, and snippets.


Josh Williams sjwilliams

View GitHub Profile
james2doyle / Modernizr.cssclip.js
Created May 18, 2016
A Modernizr test for CSS Clip. Also some helper classes are added as well.
View Modernizr.cssclip.js
// FROM:
// Here are all the values we will test. If you want to use just one or two, comment out the lines of test you don't need.
var tests = [
{ name: 'svg', value: 'url(#test)' }, // False positive in IE, supports SVG clip-path, but not on HTML element
{ name: 'inset', value: 'inset(10px 20px 30px 40px)' },
{ name: 'circle', value: 'circle(60px at center)' },
{ name: 'ellipse', value: 'ellipse(50% 50% at 50% 50%)' },
{ name: 'polygon', value: 'polygon(50% 0%, 0% 100%, 100% 100%)' }
hazcod / apache-plex-reverse-proxy.vhost
Last active Apr 15, 2021
Apache2 reverse proxy vhost configuration for Plex. Rerquires modules ssl, proxy, wstunnel
View apache-plex-reverse-proxy.vhost
This current configuration is based of at least Server Version and Web Version: 3.108.2.
This updated config file allows the playing of trailers and TV Show theme music where as the previous one did not.
## Requirements
1. Apache version > 2.4
2. A bunch of mod's enabled (proxy, ssl, proxy_wstunnel, http, dir, env, headers, proxy_balancer, proxy_http, rewrite)
3. Protocols h2 http/1.1 needs apachectl -V 2.4.17 and higher...
## Apache .conf file
stevejenkins /
Last active Mar 30, 2021
Simple shell script to remotely reboot a Ubiquiti UBNT UniFi Access Point (UAP, UAP-PRO, UAP-AC, etc.)
leommoore /
Last active Aug 8, 2018
Letsencrypt Ubuntu 14.04 Nginx

#Letsencrypt Ubuntu 14.04 Nginx Letsencrypt ( is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain.

Note: As of 8th March 2016 letsencrypt is still in public beta.

##Installation To install the client, clone the repostiory from github.

git clone
View git-go.js
#!/usr/bin/env node
var cmds = [];
if (process.argv.length < 3) {
console.log('You need to provide a commit message!');
cmds.push('git add -A');
cmds.push('git add -u');
joshua-barnett / pan-zoom-image.js
Last active Oct 16, 2018
A simple way of panning and zooming an image using Hammer.js.
View pan-zoom-image.js
// <img id="myimage" src="http://placecage/1280/720">
var image = document.getElementById('myimage');
var mc = new Hammer.Manager(image);
var pinch = new Hammer.Pinch();
var pan = new Hammer.Pan();
wilsonpage / umd-module.js
Last active Aug 19, 2016
UMD (amd, common.js, window)
View umd-module.js
});})(typeof define=='function'&&define.amd?define
:(function(n,w){'use strict';return typeof module=='object'?function(c){
c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){
return w[n];},m.exports,m);w[n]=m.exports;};})('module-name',this));
JedWatson /
Last active Mar 26, 2021
Proposal: adding reverse-relationship population to Mongoose (as implemented in KeystoneJS)

I've developed a useful feature in KeystoneJS that lets you populate a relationship from either side, while only storing the data on one side, and am looking for feedback on whether it is something that could / should be brought back into mongoose itself. (It might be possible to add as a separate package but I suspect there'd be too much rewriting of mongoose internals for that to be a good idea).

I've added this as an issue in mongoose for consideration: #1888 but am leaving this gist in place because the examples are easier to read.

I've used Posts and Categories as a basic, contrived example to demonstrate what I'm talking about here; in reality you'd rarely load all the posts for a category but there are other real world cases where it's less unreasonable you'd want to do this, and Posts + Categories is an easy way to demo it.

The problem

The built-in population feature is really useful; not just for

View node_file_paths.markdown

#Node - File Paths

##File Paths Node has a path module which can be used to manipulate paths.

###Normalizing Paths Paths can be stored in different ways and it is neccessary to ensure that the path is standardized.

var path = require('path');
simonsmith / amd-jquery-plugin.js
Last active Apr 29, 2020
AMD compatible plugin for jQuery
View amd-jquery-plugin.js
// UMD dance -
!function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
}(this, function($) {
'use strict';