Skip to content

Instantly share code, notes, and snippets.

@shshaw
shshaw / JSfixForResponsiveSVGsInSafari.js
Created January 14, 2016 15:47
A vanilla JavaScript fix (of sorts) for responsive SVGs in Safari and some other WebKit browsers.
/*
Title: Vanilla JavaScript to fix responsive SVGs in some versions of Safari.
What it does: Stops the problem I described here: http://stackoverflow.com/q/17158717/1147859 Reference URL of the issue: http://codepen.io/benfrain/full/fhyrD
It will work on all SVGs referenced inside objects as long as given the class .emb:
<object class="emb" data="img/cup.svg" type="image/svg+xml"></object>
And also any inline SVGs.
@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 / functions.php
Last active August 22, 2016 10:39 — forked from fardog/functions.php
Fixes a `Creating default object from empty value` on [line 61](https://gist.github.com/fardog/9356458#file-functions-php-L61)
<?php
function north_cast_api_data($content) {
if (is_numeric($content)) $content = intval($content);
else {
$unserialized_content = @unserialize($content);
// we got serialized content
if ($unserialized_content !== false) {
// make sure that integers are represented as such, instead of str
foreach ($unserialized_content as $fn => &$c) {