Skip to content

Instantly share code, notes, and snippets.

@mattsnider
mattsnider / super_simple_image_viewer_v3.js
Created Dec 14, 2012
Standalone version of the super simple image viewer
View super_simple_image_viewer_v3.js
(function(w, d) {
// simple function to get element by ID
function _getEl(el) {
if ('string' === typeof(el)) {
var sError = 'element' + el + ' does not exist';
el = d.getElementById(el);
if (! el) {
alert(sError);
}
@mattsnider
mattsnider / super_simple_image_viewer_jquery.js
Created Dec 14, 2012
jQuery version of the super simple image viewer
View super_simple_image_viewer_jquery.js
(function(w, d) {
/**
* Instantiation function for the jQuery-based SimpleImageViewer.
* @param elImage {String|Element} Required. The ID or element instance for the image element to be updated.
* @param conf {Object} Optional. Additional configuration options:
* caption - The ID or element instance for the caption element to be updated.
* defaultGroup - The label for your default group of images. If you have just one collection of images,
* just leave this blank.
* next - The ID or element instance for the element to trigger changing to the next image.
* previous - The ID or element instance for the element to trigger changing to the previous image.
@mattsnider
mattsnider / somewhat_simple_image_viewer.js
Created Dec 14, 2012
Improved Somewhat Simple Image Viewer
View somewhat_simple_image_viewer.js
/**
* Copyright (c) 2007, Matt Snider, LLC. All rights reserved.
* Version: 1.2
*/
var Core = {Widget: {}};
/**
* The PhotoViewer class manages the slide show logic , requires a data object and a configuration object of DOM elements.
* @namespace Core.Widget
@mattsnider
mattsnider / yahoo-dom-event.js
Created Dec 14, 2012
Minified Dom and Event modules from YUI 2.3
View yahoo-dom-event.js
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/
if(typeof YAHOO=="undefined"){var YAHOO={};}
YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
@mattsnider
mattsnider / gist:4288138
Created Dec 14, 2012
YUI 2.x version of the super simple image viewer
View gist:4288138
(function(w, d) {
// simple function to get element by ID
var _getEl = YAHOO.util.Dom.get;
/**
* Instantiation function for the SimpleImageViewer.
* @param elImage {String|Element} Required. The ID or element instance for the image element to be updated.
* @param conf {Object} Optional. Additional configuration options:
* caption - The ID or element instance for the caption element to be updated.
* defaultGroup - The label for your default group of images. If you have just one collection of images,
@mattsnider
mattsnider / simple_javascript_event_wrapper.js
Created Feb 15, 2013
Dead simple wrapper for event functions in JavaScript. Adds addListener and removeListener to the global namespace.
View simple_javascript_event_wrapper.js
(function(w) {
// Create the Event Function wrappers
if (w.addEventListener) {
// standards compliant method
w.addListener = function(el, eType, fn, capture) {
el.addEventListener(eType, fn, capture);
};
w.removeListener = function (el, eType, fn, capture) {
el.removeEventListener(eType, fn, capture);
};
View requestanimationframe.js
// Modified from http://mattsnider.com/cross-browser-and-legacy-supported-requestframeanimation/
// LICENSE: MIT: http://mattsnider.com/projects/license/
(function(w) {
"use strict";
// most browsers have an implementation
w.requestAnimationFrame = w.requestAnimationFrame ||
w.mozRequestAnimationFrame || w.webkitRequestAnimationFrame ||
w.msRequestAnimationFrame;
w.cancelAnimationFrame = w.cancelAnimationFrame ||
@mattsnider
mattsnider / Arecibo Install.md
Last active Dec 21, 2015
Steps for installing Arecibo intern project
View Arecibo Install.md
@mattsnider
mattsnider / iOSAndjQueryMobileBase.html
Created Aug 23, 2013
A Django template extending the Django-HTML5-Boilerplate package using jQueryMobile to create a base template for a mobile HTML5 application. https://github.com/mattsnider/django-html5-boilerplate http://jquerymobile.com/
View iOSAndjQueryMobileBase.html
{% extends 'dh5bp/base_script_in_head.html' %}
{% load staticfiles %}
{% load url from future %}
{% block title %}{APP_TITLE}{% endblock %}
{% block head %}
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-startup-image" href="{% static '{STATIC_IMAGE_PATH}/startup-image.png' %}">
@mattsnider
mattsnider / annotation.js
Last active Oct 8, 2017
JavaScript function for annotating other JavaScript
View annotation.js
function annotate(fnToAnnotate) {
// already annotation aware, use the original annotation chain
if (fnToAnnotate.by) {
return fnToAnnotate;
}
var aAnnotationChain = [fnToAnnotate];
function applyChainFunctions(fn) {
fn.by = function(fnAnnotation, arg1, /*...*/ argN) {
You can’t perform that action at this time.