Skip to content

Instantly share code, notes, and snippets.

@martinrue
martinrue / serve.js
Created March 18, 2021 16:49
Using esbuild's serve function for an SPA, equivalent to webpack's `devServer.historyApiFallback`.
const http = require("http");
const esbuild = require("esbuild");
const serve = async (servedir, listen) => {
// Start esbuild's local web server. Random port will be chosen by esbuild.
const { host, port } = await esbuild.serve({ servedir }, {});
// Create a second (proxy) server that will forward requests to esbuild.
const proxy = http.createServer((req, res) => {
// forwardRequest forwards an http request through to esbuid.
@mpellegrini
mpellegrini / RestEasyLogger.java
Last active May 19, 2020 07:55
JAX-RS Provider and RestEasy Interceptor to Log request / response messages
import org.jboss.resteasy.annotations.interception.ServerInterceptor;
import org.jboss.resteasy.core.ResourceMethod;
import org.jboss.resteasy.core.ServerResponse;
import org.jboss.resteasy.spi.Failure;
import org.jboss.resteasy.spi.HttpRequest;
import org.jboss.resteasy.spi.interception.MessageBodyWriterContext;
import org.jboss.resteasy.spi.interception.MessageBodyWriterInterceptor;
import org.jboss.resteasy.spi.interception.PreProcessInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@finscn
finscn / NewFile.py
Created June 19, 2015 07:39
A plugin of SublimeText 3 : Let the FOLDER of a new untitled file be as same as the folder of current activated file.
# NewFileAtCurrentFolder
import sublime_plugin
import os.path
class NewFileListener(sublime_plugin.EventListener):
def on_new_async(self, view):
if not view.window().active_view():
print("NF: no view")
return
@lstoll
lstoll / gist:1213260
Created September 13, 2011 06:33
Play framework pulling modules directly from GitHub
## Sadly this doesn't work yet, because the github zipball includes the content in a sub dir, rather than the root dir.
## So you end up with: ls modules/scala-0.9.1/lstoll-play-scala-6290346/
# Application dependencies
require:
- play
- play -> crud
# Version number can be a tag or a branch
- com.github.playframework -> scala 0.9.1