Skip to content

Instantly share code, notes, and snippets.

View kalexander's full-sized avatar

Kevin Alexander kalexander

View GitHub Profile
@kalexander
kalexander / gist:527650fcf216c33f287d
Last active August 29, 2015 14:22
simple proxying
PROBLEM:
The Product Importer has lots of crazy report formats that vary wildly from report to report. To reduce
the strain on requiring TWIKI to model these in JSON marshallers/unmarshallers, I have created a happy
path proxy scenario that just passes along the response of a request.
This is using the NEWMAN framework https://github.com/stackmob/newman.. The TwikiService
has an existing example of the use of Newman.
In a route, add something like:
def happy(i: Long): Boolean = {
def lilHappy(ii: Long, count: Long = 0): Boolean = {
val num = ii.toString.map(_.asDigit).map(x => (x*x).toLong).sum
if(num == 1) true
else if( count == 30) false
else lilHappy(num, count + 1)
}
lilHappy(i)
}
@kalexander
kalexander / gist:5579118
Created May 14, 2013 20:14
playing with file contents on the client side....
<html>
<body>
<form name="uploadForm">
<input id="uploadFile" type="file" name="uploadFile" onchange="performFilePoop();" />
</form>
<script>
function performFilePoop(){
var files = document.getElementById("uploadFile").files