Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Ralston pherris

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am pherris on github.
  • I am pherris (https://keybase.io/pherris) on keybase.
  • I have a public key ASCazMM-vWH2zvCDekjxvuqGopJnewXnhWxA642KEhy3nwo

To claim this, I am signing this object:

@pherris
pherris / quickstart.js
Created Aug 19, 2015
Gmail API Email Processing with MySQL connection pooling (hackathon)
View quickstart.js
var fs = require('fs');
var readline = require('readline');
var google = require('googleapis');
var googleAuth = require('google-auth-library');
var _ = require('underscore');
var Promise = require('promise/setimmediate');
var SCOPES = [
'https://www.googleapis.com/auth/gmail.compose',
'https://www.googleapis.com/auth/gmail.readonly',
@pherris
pherris / superagent.js
Last active Oct 5, 2020
Jest superagent mock
View superagent.js
'use strict';
//mock for superagent - __mocks__/superagent.js
var mockDelay;
var mockError;
var mockResponse = {
status() {
return 200;
},
View moment-immutable.tag
<pack:script enabled="${packTagEnabled}" minify="false" prefix="script-moment-immutable">
<src>/js/alm/builds/bower/moment/2.9.0/<c:if test="${packTagEnabled}">min/</c:if>moment<c:if test="${packTagEnabled}">.min</c:if>.js</src>
<src>/js/alm/builds/bower/moment-timezone/0.3.0/builds/moment-timezone.<c:if test="${packTagEnabled}">min.</c:if>js</src>
<src>/js/alm/builds/bower/immutable/3.6.2/dist/immutable<c:if test="${packTagEnabled}">.min</c:if>.js"></src>
</pack:script>
@pherris
pherris / app.js
Created Dec 18, 2014
Node parse HTML file and publish to Flowdock
View app.js
var htmlparser = require("htmlparser");
var fs = require('fs');
var sys = require("sys");
var _ = require('lodash');
var prettyjson = require('prettyjson');
var express = require('express');
var bodyParser = require('body-parser');
var requestify = require('requestify');
var app = express();
@pherris
pherris / index.html
Last active Aug 29, 2015
Continual monitoring of JS latency on the client
View index.html
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<script>
//add logging for client latency (when detected).
//to create client latency, Rally.metrics.wait(250);
document.addEventListener('clientLatency', function (evt) {
console.log('latency!', evt.detail);
}, false);
@pherris
pherris / Component.js
Created Oct 17, 2014
Ext Component - log events
View Component.js
(function() {
var Ext = window.Ext4 || window.Ext;
Ext.define('Rally.ui.overrides.Container', {
override: 'Ext.Container',
constructor: function (config) {
if (!config) {
config = {};
}
@pherris
pherris / mutationObserver.html
Last active Aug 29, 2015
Ext Element Cache with MutationSummary Library
View mutationObserver.html
<!DOCTYPE html>
<html>
<head>
<title>ExtJS Cache Example</title>
<link href="http://cdn.sencha.com/ext/gpl/4.2.0/resources/css/ext-all.css" rel="stylesheet" />
<script src="http://cdn.sencha.com/ext/gpl/4.2.0/ext-all-debug.js"></script>
<body>
</body>
@pherris
pherris / app.js
Created Mar 24, 2014
Node app for testing rule forward...
View app.js
var express = require('express');
var app = express();
app.get('/', function(req, res){
var retryCount = req.query.retryCount;
console.log("req.query.retryCount: " + retryCount);
if (!retryCount || retryCount <3) {
res.send(500, 'retryCount under 3');
} else {
res.send('Hello World' + retryCount);
@pherris
pherris / MergeSorter.js
Created Mar 5, 2014
MergeSort example in JavaScript
View MergeSorter.js
var MergeSorter = (function () {
var merge = function (arr1, arr2) {
var result = [];
while (arr1.length > 0 && arr2.length > 0) {
if (arr1[0] <= arr2[0]) {
result.push(arr1.shift());
} else {
result.push(arr2.shift());
You can’t perform that action at this time.