Skip to content

Instantly share code, notes, and snippets.

View ratamacue's full-sized avatar

David Ron ratamacue

View GitHub Profile
ratamacue / RandomAdRotate.html
Last active December 25, 2015 07:59
This is an example of the HTML a publisher can use to place any collection of ads on his or her site so that all will be hidden except one random ad for each page refresh. You can see an example of the output here:
View RandomAdRotate.html
<div id="cj_rolling_container">
<!-- Put Your Ads In This Container Like So -->
<a href='' target='_top'>
<img src='' width='300' height='250' alt='' border='0' />
<a href='' target='_top'>
<img src='' width='300' height='250' alt='' border='0' />
package cj.util.collections;
import java.util.Iterator;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
* @author dron
* This class should be used as an "iterable" by consumers and a queue by producers.
* Unlike a normal blocking queue, the iterator will BLOCK on hasNext rather than returning false
View IteratorStream.scala
package com.cj.collections
class IteratorStream[T]( i : java.util.Iterator[T]) extends Stream[T]{
override lazy val head = { i.hasNext ; }
override lazy val tail = { head; new IteratorStream(i)}
override def tailDefined : Boolean = false
override def isEmpty : Boolean = !i.hasNext
View amaon.api.gateway.lambda.response.gatewayResponse.package.scala
package com.cj.lambda
import collection.JavaConversions._
* This package object wraps the poorly documented AWS API Gateway return value necessary to proper respond to HTTP requests in an
* AWS Lambda Scala project
package object gatewayResponse {
def response(response:ResponseCode, body:String, headers:Map[String, String] = Map()):java.util.Map[String, Object] = {

Keybase proof

I hereby claim:

  • I am ratamacue on github.
  • I am davidron ( on keybase.
  • I have a public key ASBtzY9xgIaNmveahVdRcUIFhNZf7vl0qtccUVNpuX5uLgo

To claim this, I am signing this object: