Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');| 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. |
| 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; |
Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');| # 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 |
| ## 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 |