Skip to content

Instantly share code, notes, and snippets.

View sjwilliams's full-sized avatar

Josh Williams sjwilliams

View GitHub Profile
@james2doyle
james2doyle / Modernizr.cssclip.js
Created May 18, 2016 19:06
A Modernizr test for CSS Clip. Also some helper classes are added as well.
(function(Modernizr){
// FROM: http://codepen.io/shshaw/pen/yyOaqW
// 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
hazcod / apache-plex-reverse-proxy.vhost
Last active December 9, 2023 19:02
Apache2 reverse proxy vhost configuration for Plex. Rerquires modules ssl, proxy, wstunnel
This current configuration is based of at least Server Version 1.16.5.1488 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
stevejenkins / uap-reboot.sh
Last active July 7, 2021 19:51
Simple shell script to remotely reboot a Ubiquiti UBNT UniFi Access Point (UAP, UAP-PRO, UAP-AC, etc.)
#MOVED TO: https://github.com/stevejenkins/unifi-linux-utils
@leommoore
leommoore / letsencrypt_ubuntu_nginx.md
Last active August 8, 2018 10:37
Letsencrypt Ubuntu 14.04 Nginx

#Letsencrypt Ubuntu 14.04 Nginx Letsencrypt (https://letsencrypt.org) 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 https://github.com/letsencrypt/letsencrypt.git
@gka
gka / git-go.js
Last active September 1, 2015 20:08
#!/usr/bin/env node
var cmds = [];
if (process.argv.length < 3) {
console.log('You need to provide a commit message!');
process.exit(-1);
}
cmds.push('git add -A');
cmds.push('git add -u');
@jshbrntt
jshbrntt / pan-zoom-image.js
Last active October 16, 2018 11:10
A simple way of panning and zooming an image using Hammer.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();
pinch.recognizeWith(pan);
@wilsonpage
wilsonpage / umd-module.js
Last active August 19, 2016 13:18
UMD (amd, common.js, window)
;(function(define){define(function(require,exports,module){
//...
});})(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
JedWatson / 1-proposal.md
Last active January 2, 2024 17:59
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

@emersonf
emersonf / s3etag.sh
Last active March 27, 2024 10:11
A Bash script to compute ETag values for S3 multipart uploads on OS X.
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 file partSizeInMb";
exit 0;
fi
file=$1
if [ ! -f "$file" ]; then