Skip to content

Instantly share code, notes, and snippets.

@pherris
pherris / superagent.js
Last active January 19, 2021 15:10
Jest superagent mock
'use strict';
//mock for superagent - __mocks__/superagent.js
var mockDelay;
var mockError;
var mockResponse = {
status() {
return 200;
},

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 August 19, 2015 15:27
Gmail API Email Processing with MySQL connection pooling (hackathon)
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 / Gruntfile.js
Created January 28, 2014 22:30
grunt angular file
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* Steps to build for prod:
*
* 1) copy
var magicNumberFinder = (function () {
var knownMagicNumbers = [], cacheUsedCount = 0, cacheSize = 0;
function stringImpl(num) {
var sum = 0,
prod = 1,
currentNum = "",
stringNum = ""+num;
for (i=0;i<stringNum.length;i++) {
@pherris
pherris / gist:7376745
Created November 8, 2013 19:59
AWS Route 53 DNS manipulation with Gradle.
/**
* Updates the IP addresses
*/
void assignInstancesToURL(url) {
initInstancesFromReservationId()
// all the changes to make
def changes = new ArrayList<com.amazonaws.services.route53.model.Change>()
def existingDNS = listRecordSets()
@pherris
pherris / history.html
Created September 23, 2013 18:59
Web interface for range query for IOT-Value-Cycling
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html {
height: 100%
}
body {
@pherris
pherris / index.html
Created September 23, 2013 14:50
Web interface for IOT-Value-Cycling project
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
@pherris
pherris / CyclingPublisher.java
Created September 23, 2013 14:49
Java publisher for IOT-Value-Cycling project
package com.pherris;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
@pherris
pherris / pom.xml
Created September 23, 2013 14:48
maven configuration for IOT-Value-Cycling project
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pherris</groupId>
<artifactId>IOT-Value-Cycling</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>IOT-Value-Cycling</name>