Skip to content

Instantly share code, notes, and snippets.

# Artie - Artie Server
#
# Real-time messaging service
description "artie"
start on filesystem
stop on runlevel S
respawn
package ecc.dashboard.persistent.repository;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* Cloud Foundry 2012.02.03 Beta
* Copyright (c) [2009-2012] VMware, Inc. All Rights Reserved.
*
* This product is licensed to you under the Apache License, Version 2.0 (the "License").
* You may not use this product except in compliance with the License.
*
* This product includes a number of subcomponents with
* separate copyright notices and license terms. Your use of these
* subcomponents is subject to the terms and conditions of the
@cemo
cemo / gist:4706565
Created February 4, 2013 12:50
typeahead-ajax
$(document).ready(function () {
var $input = $('#testcemo');
$input.typeahead({
source: function (query, process) {
return $.getJSON('/mybackoffice/demo/user', { query: query }, function (data) {
var val = $input.data("typeahead-ajax-val"),
id = $input.data("typeahead-ajax-id"),
mapped = {},
labels = []
If you don't care about the return value of the IIFE, it could also be any of the following:
!function(){}(); // => true
~function(){}(); // => -1
+function(){}(); // => NaN
-function(){}(); // => NaN
Let's explore this a bit more.
// module1.js
(function() {
@cemo
cemo / rate_limit.js
Created November 21, 2012 20:07 — forked from mattheworiordan/rate_limit.js
Rate limiting function calls with JavaScript and Underscore.js
/* Extend the Underscore object with the following methods */
// Rate limit ensures a function is never called more than every [rate]ms
// Unlike underscore's _.throttle function, function calls are queued so that
// requests are never lost and simply deferred until some other time
//
// Parameters
// * func - function to rate limit
// * rate - minimum time to wait between function calls
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request
package com.yammer.dropwizard.validation;
import com.google.common.base.Joiner;
import com.google.common.collect.*;
import org.hibernate.validator.internal.engine.ConstraintValidatorFactoryImpl;
import javax.validation.*;
import javax.validation.groups.Default;
import java.util.Set;
@cemo
cemo / gist:3842008
Created October 5, 2012 19:58 — forked from christophercurrie/gist:3841860
Guice for Dropwizard
@Override
public ServletContainer getJerseyContainer(DropwizardResourceConfig resourceConfig,
MyServiceConfig serviceConfig) {
// I like having a root module, but you can use as many as you like
final Injector injector = Guice.createInjector(new MyServiceModule(serviceConfig));
return new GuiceContainer(injector) {
@Override
public ResourceConfig getDefaultResourceConfig(Map<String,Object> props, WebConfig webConfig) {
@cemo
cemo / AddNumbersService.java
Created September 6, 2012 07:46 — forked from dmorgantini/AddNumbersService.java
Use SOAP with dropwizard
package com.example.helloworld.resources;
import javax.jws.WebMethod;
@javax.jws.WebService(
name = "AddNumbersPortType",
serviceName = "AddNumbersService",
targetNamespace = "http://duke.example.org")
@javax.jws.soap.SOAPBinding(
style = javax.jws.soap.SOAPBinding.Style.DOCUMENT,
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.codehaus.jackson.map.Module;
import org.junit.After;
import org.junit.Before;
import com.google.common.collect.Lists;