Skip to content

Instantly share code, notes, and snippets.

View ray-peters's full-sized avatar

Ray Peters ray-peters

  • San Francisco, CA
View GitHub Profile
AA
AAPL
ABC
ACN
ADBE
ADP
ADSK
AET
AGN
AKAM
var consoleLogSpy = function() {
return {
start: _start,
stop: _stop
};
function _start( callback ) {
/**
* @author Ray Peters <me@raypeters.com>
* If this helped you out, please let me know! Happy coding.
*/
/**
* handleObj
*
* type: String: The type of event, such as "click". When special event mapping
* is used via bindType or delegateType, this will be the mapped type.

before

criteriaOptions = [ 
  {
    key: "startDate",
    type: "date",
    name: "Start Date",
    beforeLabel: "Show me between ",
 default: moment( new Date ).subtract( 1, "year" ).toDate(),
/**
* A dynamic throttling function.
* -> See a demo @ https://jsfiddle.net/raypeters/nkk71qjk/
*
* @method throttleUntil
* @_condition {Function} the function that determines if the next call is locked
* @_options {Object} a namespace for instance options
* @_options.onLeading {Function} ran continuously until locked
* @_options.onTrailing {Function} ran once upon unlock
* @_options.onThrottle {Function} ran if locked
/**
*
* According to https://www.w3.org/TR/css-transforms-1/#transform-rendering:
* "Specifying a value other than ‘none’ for the ‘transform’ property
* establishes a new local coordinate system at the element that it is
* applied to."
*
* Foundation's off canvas menu uses the transform property, causing nested
* elements with `position: fixed` to be relative to the parent container
/**
* Overlays iframes to prevent capturing mousewheels while
* scrolling down a long page. Click to destroy.
*
* @author Ray Peters <me@raypeters.com>
*/
;( function(){
$(function(){
$( "iframe" ).each( function(){
addOverlay( $( this ) );
@ray-peters
ray-peters / ng-file-upload-fix.js
Created March 4, 2016 20:25
Fix for ng-file-upload - Create and segment invalids via an error blacklist. Do not mark files invalid because of maxLength.
function separateInvalids() {
var skipErrors = [ "maxFiles" ];
valids = [];
invalids = [];
angular.forEach(allNewFiles, function (file) {
if (file.$error) {
if ( skipErrors.indexOf( file.$error ) !== -1 ) return;
invalids.push(file);
$( document ).ready(
function() {
//$('*[opt-id="74478fdc-1885-0eba-36ab-4387fd0c15bb"]').hide();
//$("a[href='http://ontraport.com/fakelink']").attr('href', 'javascript:show_chapters()');
var navIsOn = false;
$( document.body ).on( "click", "a[href='http://ontraport.com/fakelink']", function( ev ){
if ( navIsOn ) {
hide_chapters();
navIsOn = false;
@ray-peters
ray-peters / random-test.js
Created January 7, 2016 22:50
Testing what throws do to the event loop
var queueJob = function(){
var total = 0;
return function( count ) {
count || ( count = 1 );
for ( var i = 0; i < count; ++i ) {
setTimeout( function(){
++total;
console.log( "job: ", total );