Skip to content

Instantly share code, notes, and snippets.

View garyv's full-sized avatar
🦕
hungry

Gary Von Schilling garyv

🦕
hungry
View GitHub Profile
@garyv
garyv / jquery.selectfilter.js
Created February 29, 2016 17:10
jQuery selectFilter
/*
jQuery selectFilter
This jQuery plugin generates select boxes to filter items based on their data attributes
Example of use:
$('#event-filters')
.selectFilter('country')
function embedVimeo( img ) {
// replace an image inside a Vimeo.com link with embeded video player
var link = img.parents( 'a' ),
urlParts = link.attr( 'href' ).split( '/' ),
width = img.width(),
height = img.height(),
id = urlParts[urlParts.length - 1].split( '&' )[0],
url = '<iframe src="/web/20130516162657/http://player.vimeo.com/video/-id-?byline=0&amp;portrait=0&amp;color=e7e7e7&autoplay=1;" width="-w-" height="-h-" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
embed = url.replace(/-id-/, id).replace(/-w-/, width).replace(/-h-/, height);
@garyv
garyv / Readme.md
Last active December 15, 2015 00:39
Detecting HTML5 browsers

This is an attempt to make a HTML boilerplate that simplifies progressive enhancement.

It operate under the assumption that their are two types of browsers:

  • those that support HTML5
  • those that don't

By HTML5, I'm not just talking about markup - I'm using the more nebulous definition that includes many JavaScript APIs and CSS selectors associated with modern web applications.

A breif script in the head judges if the browser is worthy. This is based on detection of two modern DOM API's: one for selecting elements, and one for attaching events.

@garyv
garyv / firebug.js
Created December 4, 2012 22:35
load Firebug console on any webpage with JavaScript
function firebug(){
var s = document.createElement( 'script' );
s.src = 'https://getfirebug.com/firebug-lite-beta.js#startOpened';
document.head.appendChild(s);
}
firebug();
@garyv
garyv / hamlhtml5boilerplate.html.haml
Created November 19, 2012 22:52 — forked from johnrees/hamlhtml5boilerplate.html.haml
Rails 3.1.1 barebones HAML HTML5Boilerplate
!!!
/[if lt IE 7] <html class="no-js ie6 oldie" lang="en">
/[if IE 7] <html class="no-js ie7 oldie" lang="en">
/[if IE 8] <html class="no-js ie8 oldie" lang="en">
<!--[if (gt IE 8)]><html lang="en" class="no-js"><![endif]-->
%head
%meta{charset: "utf-8"}
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
%title 'Rails 3.1.1 barebones HTML5Boilerplate'
@garyv
garyv / preload_images.js
Created October 31, 2012 19:14
Simple image preloading with jQuery
$.preloadImages = function() {
for (var i = arguments.length; i-->0 ;) {
$('<img />').attr('src', arguments[i]);
}
}
// How to use
// $.preloadImages('/images/logo.png',
// 'http://upload.wikimedia.org/wikipedia/commons/3/38/Github.png',
var flyAway = function( flyer, props ) {
var defaults = {
fps: 11,
no_of_frames: 6,
duration: 3200,
delay: 1500,
left: '550px',
top: '-400px',
origin_left: '80px',
origin_top: '540px',
@garyv
garyv / database.yml.example mysql2
Created August 29, 2012 14:28 — forked from erichurst/database.yml.example mysql2
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@garyv
garyv / svg_replace.html
Created August 21, 2012 03:24
SVG image replacement for retina displays
<!doctype html>
<html>
<head>
<title>
SVG image replacement for retina displays
</title>
<meta charset='utf-8'>
</head>
<body>
@garyv
garyv / jquery.sidescroll.js
Created July 18, 2012 17:14
A continous side scrolling jquery plugin
// jquery.sidescroll.js
// https://gist.github.com/3137543
// A continous side scrolling jquery plugin
// How to use:
// $( 'ul.slideshow' ).sideScroll()
(function JQUERY_SIDE_SCROLL( $ ) {
$.sideScroll = {
defaults: {