Skip to content

Instantly share code, notes, and snippets.

@pherris
pherris / Gruntfile.js
Created Jan 28, 2014
grunt angular file
View Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* Steps to build for prod:
*
* 1) copy
View gist:8591182
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 Nov 8, 2013
AWS Route 53 DNS manipulation with Gradle.
View gist:7376745
/**
* 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 Sep 23, 2013
Web interface for range query for IOT-Value-Cycling
View history.html
<!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 Sep 23, 2013
Web interface for IOT-Value-Cycling project
View index.html
<!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 Sep 23, 2013
Java publisher for IOT-Value-Cycling project
View CyclingPublisher.java
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 Sep 23, 2013
maven configuration for IOT-Value-Cycling project
View pom.xml
<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>