Skip to content

Instantly share code, notes, and snippets.

View TastyToast's full-sized avatar

Donnie Conner TastyToast

View GitHub Profile
@TastyToast
TastyToast / youtube-api-helper.js
Created September 4, 2013 00:32
YouTube JS API Helper
/**
* @author Rob W <[email protected]>
* @website http://stackoverflow.com/a/7513356/938089
* @version 20120724
* @description Executes function on a framed YouTube video (see website link)
* For a full list of possible functions, see:
* https://developers.google.com/youtube/js_api_reference
* @param String frame_id The id of (the div containing) the frame
* @param String func Desired function to call, eg. "playVideo"
* (Function) Function to call when the player is ready.
@TastyToast
TastyToast / urlify.js
Created September 9, 2013 23:50
Change links to urls
function urlify(text){
var urlRegex = /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\s+|$)/gi;
return text.replace(urlRegex, function(url){
return '<a href="' + url + '">' + url + '</a>';
});
};
@TastyToast
TastyToast / colorhover.css
Created December 3, 2013 00:13
Color Toggle on Hover
img {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\' filterRes=\'800\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+ */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */
-webkit-backface-visibility: hidden; /* Fix for transition flickering */
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
@TastyToast
TastyToast / enumFromObject.js
Created June 25, 2014 23:33
Create Enum From Object
/**
* Creates and enum from the object based on key values
*
* @param {object} Object
* @return {object} enum from object
*/
function buildEnumFromObject_(obj){
var createdEnum = {};
var i = 0;
@TastyToast
TastyToast / simple-async-test-suite.html
Last active August 29, 2015 14:08
Simple async test
<!doctype html>
<html>
<head>
<title>Simple Test Suite</title>
<script>
(function(){
var queue = []
var paused = false
var results;
Array.prototype.max = function() {
return Math.max.apply(Math, this);
}
Array.prototype.min = function() {
return Math.min.apply(Math, this);
}