Skip to content

Instantly share code, notes, and snippets.

@esfand
esfand / Readme.md
Created June 29, 2011 08:11 — forked from biilmann/Readme.md
Form extension for Webpop

Forms with the Contact extension

This contact extension for Webpop is based on writing HTML5 forms with all the validations the HTML5 spec introduces, and having Webpop carry out the validations server-side in case the browser doesn't support them (or has been sidestepped completely).

To use it, simply copy "contact.js" into the Extensions folder of your project.

Writing forms with the <pop:contact> extension is very straight forward, and while the extension can easily be used to output forms with a predefined markup, every part of the final html can be handcrafted.

Here's a simple contact form:

@Controller
@RequestMapping(value = "/book")
public class BookController {
private final Map<Integer, Book> books = new ConcurrentSkipListMap<Integer, Book>();
@RequestMapping(value = "/{id}", method = GET)
public @ResponseBody Book read(@PathVariable("id") int id) {
return books.get(id);
}
@esfand
esfand / tutorial.rst
Created February 9, 2012 18:49 — forked from mojavelinux/tutorial.asciidoc
JBoss Java EE workshop

JBoss Java EE workshop

This tutorial steps through creating, testing and deploying an application using the JBoss Java EE tools and runtimes. You can show up with nothing but Java and a passion to learn. By the end, you'll have a full application running in the cloud.

Here's the development stack we'll be using:

  • OpenShift Express
  • git
  • JBoss Forge
@esfand
esfand / gist:2260989
Created March 31, 2012 08:52 — forked from joliver/gist:1311195
NServiceBusCommitDispatcher
public sealed class NServiceBusCommitDispatcher : IPublishMessages
{
private const string AggregateIdKey = "AggregateId";
private const string CommitVersionKey = "CommitVersion";
private const string EventVersionKey = "EventVersion";
private const string BusPrefixKey = "Bus.";
private readonly IBus bus;
public NServiceBusCommitDispatcher(IBus bus)
{
@esfand
esfand / Deploy
Created April 5, 2012 15:11
WebFaction Deploy Apps using Git
I've tried now for several hours understanding how to use Git with webfaction.
And even with the documentation I cannot get it to work.
I have a Django app at: webapps/django_app/project_name/
I have a Git repo at: webapps/git_app/repos/my_repo.git
I assume the following workflow:
Make som local changes
@esfand
esfand / FailedApproach.java
Created April 9, 2012 03:55 — forked from rklemme/FailedApproach.java
Sample code for dealing with self conscious parametrized types
// Source: http://www.velocityreviews.com/forums/t745036-mixing-self-conscious-parametrized-types-with-inheritance.html
package generics2;
import java.util.SortedSet;
import java.util.TreeSet;
/**
* Base comparable class with "type self consciousness".
*/
class BaseC implements Comparable<BaseC> {
@esfand
esfand / gist:2717459
Created May 17, 2012 08:43 — forked from jbrisbin/gist:1444077
Reactor-based framework versus Node.js streaming

I've been hacking away recently at a JVM framework for doing asynchronous, non-blocking applications using a variation of the venerable Reactor pattern. The core of the framework is currently in Java. I started with Scala then went with Java and am now considering Scala again for the core. What can I say: I'm a grass-is-greener waffler! :) But it understands how to invoke Groovy Closures, Scala anonymous functions, and Clojure functions, so you can use the framework directly without needing wrappers.

I've been continually micro-benchmarking this framework because I feel that the JVM is a better foundation on which to build highly-concurrent, highly-scalable, C100K applications than V8 or Ruby. The problem has been, so far, no good tools exist for JVM developers to leverage the excellent performance and manageability of the JVM. This yet-to-be-publicly-released framework is an effort to give Java, Groovy, Scala, [X JVM language] developers access to an easy-to-use programming model that removes the necessity

@esfand
esfand / registerCustomer.coffee
Created June 20, 2012 15:27 — forked from moredip/registerCustomer.coffee
Alternative functional approach to dealing with the async pyramid. This is a response to http://wekeroad.com/2012/04/05/cleaning-up-deep-callback-nesting-with-nodes-eventemitter/
validate = (customer, next)->
console.log 'validating...'
#VALIDATE HERE
next()
insert = (customer, next)->
console.log 'inserting...'
# insert into DB (asynchronously of course), and then call...
next()
import org.glassfish.jersey.media.json.JsonJacksonModule;
import org.glassfish.jersey.server.Application;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.glassfish.jersey.test.spi.TestContainer;
import org.junit.Test;
import javax.ws.rs.core.MediaType;
@esfand
esfand / .excludes
Created March 9, 2013 08:07 — forked from dwayne/.excludes
# Exclude files that don't need to be on the server
# Used by rsync when deploying code to the server
.excludes
.git
.gitignore
log/
tmp/