Skip to content

Instantly share code, notes, and snippets.

@ratamacue
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: http://jsfiddle.net/TUats/embedded/result/
<div id="cj_rolling_container">
<!-- Put Your Ads In This Container Like So -->
<a href='http://www.kqzyfj.com/click-6743399-11396752' target='_top'>
<img src='http://www.lduhtrp.net/image-6743399-11396752' width='300' height='250' alt='' border='0' />
</a>
<a href='http://www.kqzyfj.com/click-6743399-11396757' target='_top'>
<img src='http://www.lduhtrp.net/image-6743399-11396757' 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
package com.cj.collections
class IteratorStream[T]( i : java.util.Iterator[T]) extends Stream[T]{
override lazy val head = { i.hasNext ; i.next }
override lazy val tail = { head; new IteratorStream(i)}
override def tailDefined : Boolean = false
override def isEmpty : Boolean = !i.hasNext
}
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 (https://keybase.io/davidron) on keybase.
  • I have a public key ASBtzY9xgIaNmveahVdRcUIFhNZf7vl0qtccUVNpuX5uLgo

To claim this, I am signing this object: