Skip to content

Instantly share code, notes, and snippets.

View ReedD's full-sized avatar
🎯
Focusing

Reed Dadoune ReedD

🎯
Focusing
View GitHub Profile
@ReedD
ReedD / delay.js
Created May 15, 2014 17:49
A function wrapper to repeatedly delay a given JavaScript function
/**
* A function wrapper to repeatedly delay a given function
* Example:
*
* // Generic usage
* delay(function () {
* console.log('1 second delay');
* }, 1000);
*
* // Namespaced delay
@ReedD
ReedD / index.js
Created April 29, 2014 18:07
AngularJS - Cancel http request before completion.
var canceler = $q.defer();
$http.get('/someUrl', {timeout: canceler.promise}).success(successCallback);
// later...
canceler.resolve(); // Aborts the $http request if it isn't finished.
@ReedD
ReedD / AppModel.php
Last active February 18, 2016 07:32
A CakePHP model function to find and sort by the distance from a given a latitude and longitude coordinate with the option to restrict to a given radius.
<?php
App::uses('Model', 'Model');
App::uses('String', 'Utility');
class AppModel extends Model {
/**
* @author Reed Dadoune
* distanceQuery