Skip to content

Instantly share code, notes, and snippets.

Josh Williams sjwilliams

View GitHub Profile
@james2doyle
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
(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 Jun 4, 2020
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 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 Feb 10, 2019
Simple shell script to remotely reboot a Ubiquiti UBNT UniFi Access Point (UAP, UAP-PRO, UAP-AC, etc.)
View uap-reboot.sh
#MOVED TO: https://github.com/stevejenkins/unifi-linux-utils
@leommoore
leommoore / letsencrypt_ubuntu_nginx.md
Last active Aug 8, 2018
Letsencrypt Ubuntu 14.04 Nginx
View letsencrypt_ubuntu_nginx.md

#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
View git-go.js
#!/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');
@joshua-barnett
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();
pinch.recognizeWith(pan);
@wilsonpage
wilsonpage / umd-module.js
Last active Aug 19, 2016
UMD (amd, common.js, window)
View umd-module.js
;(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 May 12, 2020
Proposal: adding reverse-relationship population to Mongoose (as implemented in KeystoneJS)
View 1-proposal.md

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');
path.normalize('/foo/bar//baz/asdf/quux/..');
@simonsmith
simonsmith / amd-jquery-plugin.js
Last active Apr 29, 2020
AMD compatible plugin for jQuery
View amd-jquery-plugin.js
// UMD dance - https://github.com/umdjs/umd
!function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
factory(root.jQuery);
}
}(this, function($) {
'use strict';
You can’t perform that action at this time.