Skip to content

Instantly share code, notes, and snippets.

View jlittlejohn's full-sized avatar

Josh Littlejohn jlittlejohn

View GitHub Profile
@jlittlejohn
jlittlejohn / gist:9645921
Created March 19, 2014 16:46
WP: Allow SVG through WP Media Uploader
function cc_mime_types( $mimes ){
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );
@jlittlejohn
jlittlejohn / gist:8834074
Last active November 28, 2020 21:50
SCSS: Filter (Mixin)
@mixin filter($value) {
-webkit-filter: $value;
-moz-filter: $value;
-o-filter: $value;
filter: $value;
}
@jlittlejohn
jlittlejohn / gist:7940729
Created December 13, 2013 06:55
JS: Animate SVG Paths
/* HTML
<button onclick="rerun();">Again!</button>
<div id="myobj" width="100%" height="100%">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 152.5 63.5" enable-background="new 0 0 152.5 63.5" xml:space="preserve">
<path id="i0" fill="none" stroke="#000000" d="M22.057,5.69c2.4,0,4.596,0.354,6.588,1.062s3.696,1.71,5.112,3.006
c1.416,1.296,2.52,2.856,3.312,4.68c0.792,1.824,1.188,3.852,1.188,6.084c0,1.92-0.282,3.696-0.846,5.328
c-0.564,1.632-1.32,3.192-2.268,4.68c-0.948,1.488-2.058,2.928-3.33,4.32c-1.272,1.393-2.604,2.808-3.996,4.248L16.081,51.086
@jlittlejohn
jlittlejohn / gist:7940518
Last active May 1, 2019 16:03
SVG: Inline SVG with Fallback
<svg width="96" height="96">
<image xlink:href="svg.svg" src="svg.png" width="96" height="96"/>
</svg>
@jlittlejohn
jlittlejohn / gist:7930549
Created December 12, 2013 16:11
SCSS: Animate Sprite Background Using CSS
/* HTML
<div class="animation"></div>
*/
/*-- Keyframes & Animation Mixins --*/
@mixin keyframes($name) {
@-webkit-keyframes #{$name} {
@jlittlejohn
jlittlejohn / gist:7930105
Created December 12, 2013 15:47
SCSS: Animation (Mixin)
@mixin animation($content) {
-webkit-animation: $content;
-moz-animation: $content;
-ms-animation: $content;
-o-animation: $content;
animation: $content;
}
@jlittlejohn
jlittlejohn / gist:7826544
Created December 6, 2013 15:31
HTACCESS: Remove www from the domain
RewriteCond %{HTTP_HOST} ^www\.domainname\.com$ [NC]
RewriteRule ^(.*)$ http://domainname.com/$1 [R=301,L]
@jlittlejohn
jlittlejohn / gist:7815302
Created December 5, 2013 22:39
SCSS: Transparent Borders
.transparent-border {
-moz-background-clip: padding; /* Firefox 3.6 */
-webkit-background-clip: padding; /* Safari 4? Chrome 6? */
background-clip: padding-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */
border: 20px solid rgba(0,0,0,0.3);
-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
@jlittlejohn
jlittlejohn / gist:7814436
Created December 5, 2013 21:42
JS: Remove Hover Events on Scroll
/* CSS
.disable-hover, .disable-hover * {
pointer-events: none !important;
}
*/
var body = document.body,
timer;
window.addEventListener('scroll', function() {
@jlittlejohn
jlittlejohn / gist:7795999
Created December 4, 2013 21:33
SCSS: Vertically/Horizontally Align Container
.center-container {
position: relative;
}
.absolute-center {
width: 50%;
height: 50%;
overflow: auto;
margin: auto;
position: absolute;