Skip to content

Instantly share code, notes, and snippets.

View jeanlaurent's full-sized avatar

Jean-Laurent de Morlhon jeanlaurent

View GitHub Profile
@htsh
htsh / gist:5796569
Created June 17, 2013 12:39
non-coffee version of user blakematrix's method to remove leading 'www''s from urls in express
app.get('/*', function(req, res, next) {
if (req.headers.host.match(/^www\./) != null) {
res.redirect("http://" + req.headers.host.slice(4) + req.url, 301);
} else {
next();
}
});
@yamsellem
yamsellem / JongoJacksonMapperProvider
Created July 21, 2012 13:30
Jongo Jackson provider to make Jersey serves ObjectId as String
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY;
import static org.codehaus.jackson.map.DeserializationConfig.Feature.AUTO_DETECT_SETTERS;
import static org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES;
import static org.codehaus.jackson.map.SerializationConfig.Feature.AUTO_DETECT_GETTERS;
import static org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_DEFAULT;
import java.io.IOException;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
@andyfowler
andyfowler / lessjs.rb
Created October 23, 2010 21:46
Jekyll plugin to render less.js - fixed for new versions of jekyll
module Jekyll
class LessCssFile < StaticFile
def write(dest)
# do nothing
end
end
# Expects a lessc: key in your _config.yml file with the path to a local less.js/bin/lessc
# Less.js will require node.js to be installed