Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jeffreytgilbert's full-sized avatar

Jeffrey Gilbert jeffreytgilbert

View GitHub Profile
@jeffreytgilbert
jeffreytgilbert / resolveApi.tsx
Created April 20, 2024 00:25
The wrong way?
import { useAuth } from "../auth/hooks/useAuth";
enum XHRFailureCodes {
AUTHENTICATION_REQUIRED = 'AUTHENTICATION_REQUIRED',
UNAUTHORIZED_ACTION = 'UNAUTHORIZED_ACTION',
FORM_VALIDATION_FAILED = 'FORM_VALIDATION_FAILED',
MISSING_REQUIRED_PARAMETERS = 'MISSING_REQUIRED_PARAMETERS',
NO_RESULTS_FOUND = 'NO_RESULTS_FOUND',
RATE_LIMIT_EXCEEDED = 'RATE_LIMIT_EXCEEDED',
UNKNOWN_ERROR = 'UNKNOWN_ERROR',
@jeffreytgilbert
jeffreytgilbert / needle-in-global-haystack.js
Created September 27, 2019 19:29
Find a needle in the global haystack of nested junk
const findNeedleInHaystack = (needle, haystack) => {
let reference = [];
let promises = [];
const finder = (obj, chain) => {
return new Promise((resolve, reject)=>{
if (reference.includes(obj)) {
return resolve(chain.join('.')); // already checked this object
}
// add object as "checked" to reference registry
reference.push(obj);
@jeffreytgilbert
jeffreytgilbert / chase-credit-card-page-has-no-balance.js
Created December 30, 2013 19:34
A little script to show the running balance on the chase cc page because they decided it's not important to keep a running balance...
(function(){
var amounts = document.querySelectorAll('#Posted tbody .amount');
var balance = Number(document.querySelector('#AccountDetailTable .card-accountdetailcol tbody tr td:nth-child(2)').innerText.substr(1).replace(',',''));
var iii=0;
var amount = '';
var element = null;
var elementsArray = [];
for(iii=0; iii < amounts.length; iii++) {
element = amounts[iii];
@jeffreytgilbert
jeffreytgilbert / notes.md
Created September 8, 2014 20:17
Research notes into browser throttling behaviors

Research

Throttling and Browser Optimization

Flash Support

It is known that certain VMs can reduce the amount of FPS allowed by Flash in order to provide a more performant experience for their users. One known software is VMWare. Because we do extensive testing using SauceLabs browser grid service through selenium webdriver, we wanted to test the compatibility with real world results on specific browsers we were seeing odd results in. Below are some of the findings from this research, which resulted in our adoption of IE11 on Windows 8 and our drop of IE optimization detection on all other Windows releases.

FPS throttle detection unsupported
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[user]
name = Jeffrey Gilbert
email = jegilbert@conversantmedia.com
[push]
default = simple
[core]
excludesfile = /Users/jgilbert/.gitignore_global
<!DOCTYPE html>
<html>
<head>
<style>
<!--
* {
font-family: Helvetica, Arial, sans-serif;
}
body {
font-family: Helvetica, Arial, sans-serif;
@jeffreytgilbert
jeffreytgilbert / warnings-filtered-out-of-phantomjs-stream.js
Last active January 1, 2016 13:58
These are the relevant bits to filter the output from a phantomjs instance when it's dumping out warnings from the old Qt library on OS X 10.9 Mavericks, since the phantom lib doesn't look to be getting updated for another 3 months or so.
var stream = require('stream'),
util = require('util');
function FilterThirdPartyWarnings(options){
// allow use without new
if (!(this instanceof FilterThirdPartyWarnings)) {
return new FilterThirdPartyWarnings(options);
}
stream.Transform.call(this, options);
@jeffreytgilbert
jeffreytgilbert / mocha-phantomjs
Last active January 1, 2016 13:58
Filter warning messages from the phantomjs output that happen on Mavericks due to using an older Qt library
#!/usr/bin/env node
var program = require('commander'),
spawn = require('child_process').spawn,
print = require('util').print,
fs = require('fs'),
path = require('path'),
exists = fs.existsSync || path.existsSync,
cwd = process.cwd(),
which = require('which'),
@jeffreytgilbert
jeffreytgilbert / order-summary.js
Created October 18, 2013 16:06
Comments on a file that needs correction
define([
'jquery',
'app/controllers/modals/view-transaction-details',
'app/controllers/modals/summary-member-savings',
'app/controllers/modals/summary-member-points',
'app/controllers/modals/promotional-new'
], function(
$,
TransactionDetails,
SummaryMemberSavings,
@jeffreytgilbert
jeffreytgilbert / gist:7027985
Created October 17, 2013 16:29
Mobile click detection without that pesky 300ms delay. Makes double clicking also work fine.
/**
* This code was written by the FED team to handle fast taps between products on the browse results page. This was necessary because
* there is no native tap event, and jquery was doing some form of magic to handle taps with a timeout. Also, native click/mousedown handlers
* do not work because there is a 300ms delay in the mobile browser in order for them to detect if it is a click or double click or gesture
* but since we have doubleclick and singleclick code here and want a fast response, we use the touchstart and touchend events to detect if an item was clicked.
* We also measure the distance from the start of the tap to the end of the tap along with if the item was tapped on at any point to be able to see
* if this is a swipe gesture or a tap gesture so scrolling and swiping are unimpeded. There is a 10px tolerance added for movement of the finger during taps.
*/
var SearchResultController = {