Skip to content

Instantly share code, notes, and snippets.

View dlabey's full-sized avatar

Darren dlabey

  • San Diego, CA
View GitHub Profile
@dlabey
dlabey / ng-slide-vertically.js
Created June 4, 2014 20:12
Angular Slide Vertically Directive
// Requires jquery.js, jquery.ui.effect.js, jquery.ui.effect-slide.js
// Usage: ng-slide-vertically="scopeVariable"
angular.module('namespace').directive('ngSlideVertically', function() {
return function(scope, element, attr) {
scope.$watch(attr.ngSlideVertically, function ngSlideVerticallyWatchAction(value){
if (value) {
$(element).show('slide');
} else {
$(element).hide('slide');
}
@dlabey
dlabey / between_elements.js
Created February 23, 2013 23:20
Get all direct siblings between 2 elements.
/**
* Between Elements
* Gets all direct siblings between 2 elements.
*
* @param {Object} The first element or the current element (from itself, starting).
* @param {Object} The last element (ending).
* @param {Array} An array for the elements to be pushed in to.
* @returns _betweenElements|Array
*/
function _betweenElements(currentElement, lastElement, elements) {
@dlabey
dlabey / jsonp.js
Created September 30, 2012 03:15
JSONP Request/Response Functions
var jsonp = function () {
return {
// JSONP Request
request: function (src, callback) {
try {
var self = this,
script = null;
if (document.getElementById('jsonp') !== null) {
script = document.getElementById('jsonp');