Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
👨‍🎨 👨‍💻

Jordan Shaw jshaw

🤖
👨‍🎨 👨‍💻
View GitHub Profile
@jshaw
jshaw / addGroupSnippit.js
Created January 13, 2012 15:19
fm-group-select sample to add groups to uploads
View addGroupSnippit.js
if ($('.groupSelectInputs').length > 0 ){
// declares the group string
var groupsString = "";
// Loops through all of the select inputs
$.each($('.groupSelectInputs'), function(i){
groupsString = groupsString == "" ? this.value : groupsString +','+ this.value;
});
@jshaw
jshaw / forminputsnippit.html
Created January 20, 2012 16:19
Update Mediasearch Gallery
View forminputsnippit.html
<fm:If value="{$$get.groupId}"><input type="hidden" name="groupId" id="groupId" value="{$$get.groupId}" /></fm:If>
@jshaw
jshaw / checkIfHTTP
Created May 23, 2012 20:57
Checks to see if there's http at the start of a url, and makes sure that it is included if missing.
View checkIfHTTP
var str="http://someurl.ca/";
str = str.search("http://") == -1 ? "http://" + str : str;
document.write(str);
@jshaw
jshaw / underscore-template-conditional.js
Created July 19, 2012 13:55
Underscore.js template conditional example
View underscore-template-conditional.js
// If URL is available URL link the image
// Otherwise just display the image
<% if ( instagram_link_url ) { %> <a href="<%= instagram_link_url %>" target="_blank"> <% } %>
<img src="<%= url %>" alt="<%= username %>" />
<% if ( instagram_link_url ) { %> </a> <% } %>
// Example 2 - Check if formated date
<% if (typeof(date) != "undefined") { %>
<span class="date"><%= date %></span>
<% } %>
@jshaw
jshaw / AnimationBounce.js
Created July 24, 2012 16:12
Animation Bounce an Percent Complete Marker
View AnimationBounce.js
// Requires jQuery & jQuery UI
$('<ELEMENT>').animate({
bottom: <VAR CalculatedPercentage>+'%',
duration: <VAR duration>
},function(){
$(this).effect("bounce", { direction:'down', times:4 }, 600);
});
@jshaw
jshaw / trackVideoPlays.js
Created July 25, 2012 20:42
Player Event Listeners and Analytics for Vimeo
View trackVideoPlays.js
Highwire.prototype._trackVideoPlays = function(){
// Gets reference to the Vimeo video player
var f = $('#VimeoPlayer'),
url = f.attr('src').split('?')[0];
// Listen for messages from the player
if (window.addEventListener){
window.addEventListener('message', onMessageReceived, false);
} else {
@jshaw
jshaw / YouTubeEventHandling.js
Created July 26, 2012 15:30
YouTube Video Playing and Finished Event Handling
View YouTubeEventHandling.js
var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '254',
width: '451',
@jshaw
jshaw / FacebookPageTabResizeiFrame.html
Created July 26, 2012 18:28
Resize the Facebook iFrame Tab Page with resizing content and different page heights on page loads.
View FacebookPageTabResizeiFrame.html
<!DOCTYPE html>
<html lang="en" style="overflow: hidden">
<body style="overflow:hidden">
<head>
<!-- You need to include jquery & FBSDK-->
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
@jshaw
jshaw / drawdrip.html
Created July 27, 2012 20:54
Draw and Drip (processing)
View drawdrip.html
<!doctype html>
<html>
<head>
<script type="text/javascript" src="processing.js"></script>
</head>
<body>
<div class="learning-demo">
<script type="application/processing">
@jshaw
jshaw / Tests.FBResize.js
Created July 30, 2012 22:49
Possibilities
View Tests.FBResize.js
window.onload = function() {
FB.Canvas.setSize({ height: $(window).outerHeight() });
}
window.onload = function() {
setTimeout(function(){
FB.Canvas.setAutoGrow();
},1000);
}