Skip to content

Instantly share code, notes, and snippets.

@shshaw
shshaw / html5video.sh
Last active August 29, 2015 14:02 — forked from liamcurry/html5video.sh
HTML5 Video format conversion with FFmpeg
#!/bin/sh
# Output file for HTML5 video
# Requirements: ffmpeg .6+ with libvorbis, theora and libvpx
# ( Install via brew with `brew install ffmpeg --with-libvorbis --with-libvpx --with-theora` )
# Usage: `./html5video.sh infile.mp4`
# Optional parameters:
# `./html5video.sh infile.mp4 -y` to force overwriting existing videos
# `./html5video.sh infile.mp4 -n 640x480` to force an output size
@shshaw
shshaw / SDIMap.js
Last active August 29, 2015 14:03
SDI Map
// jQuery's removeClass doesn't work for SVG, but this does!
// takes the object obj to remove from, and removes class remove
// returns true if successful, false if remove does not exist in obj
(function($){
$.fn.addClassSVG = function(addclass) {
var elem,
i = 0,
len = this.length;
@shshaw
shshaw / jquery.flipster_0.3.2 ALT.js
Created September 17, 2014 20:59
Attempt at rewriting some of the core functions of flipster to be a little more compartmentalized and reusable.
(function($) {
$.fn.flipster = function(options) {
var defaults = {
itemContainer: 'ul', // Container for the flippin' items.
itemSelector: 'li', // Selector for children of itemContainer to flip
// style: 'coverflow', // Switch between 'coverflow' or 'carousel' display styles
// display: 'all', // Number of items to display. Set to 'all' to show all
sideItems: 'all', // Number of items to display on each side. Set to 'all' to show all.
loop: false,
@shshaw
shshaw / Parallax Sky Background.markdown
Last active September 11, 2015 14:48
Parallax Sky Background

Parallax Sky Background

Scroll around a beautiful parallax sky, built with canvas for buttery-smooth performance.

A Pen by Shaw on CodePen.

License.

@shshaw
shshaw / half$.markdown
Created September 15, 2015 17:33
half$
(function(){
// Adds simple `addClass`, `removeClass`, `toggleClass` and `hasClass` functionality to Eacher DOM Collections.
function modifyClass(obj,act,c) {
if ( !c ) { return obj; }
var classes = c.split(' ');
eacher.each(classes,function(i,c){
obj.each(function(){
if ( this.classList ) { this.classList[act](c); }
@shshaw
shshaw / Insert Video with Javascript.markdown
Last active November 5, 2015 22:23
Insert Video with Javascript

Insert Video with Javascript

Small helper function with no dependencies that will insert a

A Pen by Shaw on CodePen.

License.

@shshaw
shshaw / magnific-popup.less
Created July 31, 2013 20:31
LESS conversion of the magnific popup SASS styles ( https://github.com/dimsemenov/Magnific-Popup )
/* Magnific Popup CSS */
////////////////////////
//
// Contents:
//
// 1. Default Settings
// 2. General styles
// - Transluscent overlay
// - Containers, wrappers
@shshaw
shshaw / Modernizr.AbsoluteCenter.js
Created August 23, 2013 21:20
Modernizr tests for Absolute Centering ( http://codepen.io/shshaw/pen/gEiDt )
// Will Absolute Centering work in this browser?
Modernizr.testStyles('#modernizr { height: 50px; width: 50px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; }', function(elem, rule) {
Modernizr.addTest('absolutecenter', Math.round(window.innerHeight / 2 - 25) === elem.offsetTop);
});
// Does this browser support Display: Table variable height?
Modernizr.testStyles('#modernizr { display: table; height: 50px; width: 50px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; }', function(elem, rule) {
Modernizr.addTest('absolutecentercontent', Math.round(window.innerHeight / 2 - 25) === elem.offsetTop);
});
@shshaw
shshaw / checklist.php
Created September 11, 2013 16:18
A simple checklist for your Wordpress pages to help you mark page completion. Drop this file in your main Wordpress directory and check off pages as you complete them. The script utilizes localStorage to save your checks. Very useful for Wordpress sites with a lot of pages.
<?php
/*////////////////////////////////////////
WORDPRESS PAGE CHECKLIST
////////////////////////////////////////*/
// Load WordPress
require_once( './wp/wp-load.php' );
?><html>
<head>