Skip to content

Instantly share code, notes, and snippets.

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

@cemo
cemo / Slf4jSessionLogger.java
Created January 25, 2012 09:30 — forked from msosvi/Slf4jSessionLogger.java
This is a wrapper class for SLF4J. It is used when EclipseLink messages need to be logged through SLF4J.
package org.eclipse.persistence.logging;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
/**
@cemo
cemo / ApplicationGuiceModule.java
Created May 6, 2012 21:09 — forked from kimble/ApplicationGuiceModule.java
Dropwizard instrumentation of Guice beans annotated with @timed
package com.developerb.dropbot;
import com.developerb.dropbot.instrumentation.MethodInvocationTimingInterceptor;
import com.google.inject.AbstractModule;
import com.yammer.metrics.annotation.Timed;
import static com.google.inject.matcher.Matchers.annotatedWith;
import static com.google.inject.matcher.Matchers.any;
/**
@cemo
cemo / ketchup-bootstrap.js
Created May 9, 2012 21:12 — forked from plecong/ketchup-bootstrap.js
jQuery Ketchup with Twitter Bootstrap
!function( $ ) {
"use strict"
$.ketchup
.createErrorContainer(function(form, el) {
var g = el.closest('.controls');
if (g) {
@cemo
cemo / gist:3197136
Created July 29, 2012 09:49 — forked from ehoch/gist:3189712
writecapture2 mutex
var mutex = false;
function load_ads()
{
if (mutex) {
setTimeout("load_ads()", 100); // try again in 100 ms?
return;
}
mutex = true;
if (!$('#pushdown').html()) {
@cemo
cemo / DropwizardTestServer.java
Created August 15, 2012 20:31 — forked from kimble/DropwizardTestServer.java
JUnit @rule for running Dropwizard integration test. Ps! This is just a proof of concept. There are probably some landminds lying around waiting to go off, especially around lifecycle management and static state
package com.developerb.dropwizard;
import com.yammer.dropwizard.AbstractService;
import com.yammer.dropwizard.Service;
import com.yammer.dropwizard.cli.Command;
import com.yammer.dropwizard.config.Configuration;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
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;
@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,
@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 / 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