Skip to content

Instantly share code, notes, and snippets.

Georgios Valotasios valotas

Block or report user

Report or block valotas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@valotas
valotas / tomcat.sh
Created May 31, 2011
Tomcat init.d script
View tomcat.sh
#!/bin/bash
#
# tomcat7 This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
@valotas
valotas / GuiceHandler.java
Created May 30, 2011
Grizzly 2 with guice 3
View GuiceHandler.java
import javax.servlet.ServletContextEvent;
import org.glassfish.grizzly.servlet.ServletHandler;
import com.google.inject.servlet.GuiceFilter;
import com.google.inject.servlet.GuiceServletContextListener;
public class GuiceHandler extends ServletHandler {
private static final Logger logger = Logger.getLogger(GuiceHandler.class.getName());
private final GuiceServletContextListener guiceServletContextListener;
@valotas
valotas / index.html
Last active Aug 15, 2018
RxJs Marble testing
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.2/dist/global/Rx.KitchenSink.umd.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine-html.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/boot.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
@valotas
valotas / index.js
Last active Sep 18, 2017
download vscode vsix files
View index.js
const { JSDOM } = require("jsdom");
const semver = require("semver");
const Listr = require("listr");
const { Observable } = require("rxjs");
const http = require("https");
const fs = require("fs");
function fetchPluginInfo(plugin) {
return JSDOM.fromURL(
`https://marketplace.visualstudio.com/items?itemName=${plugin}`
@valotas
valotas / CharArrayWriterResponse.java
Created Sep 25, 2011
Get the output of an the web container as string
View CharArrayWriterResponse.java
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
public class CharArrayWriterResponse extends HttpServletResponseWrapper {
private final CharArrayWriter charArray = new CharArrayWriter();
@valotas
valotas / index.html
Last active May 15, 2017
Promise.inSequence
View index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine-html.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/boot.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Promise.inSequence</title>
View create-hot-cold-observable.js
/*eslint-env jasmine*/
import Rx from 'rxjs';
fdescribe('TestScheduler', () => {
describe('createHotObservable()', () => {
it('should create a hot observable emmiting the values given as marble strings', () => {
//given
const scheduler = new Rx.TestScheduler(null);
@valotas
valotas / override-app-render.ts
Last active Dec 31, 2015
A way to override express' app.render function
View override-app-render.ts
app.use((req: express.Request, resp: express.Response, next?: Function) => {
var render = resp.render;
resp.render = (view: string, options?: any, fn?: any) => {
if ('function' == typeof options) {
fn = options;
options = {};
}
render.call(resp, view, options, (err, html) => {
if (html) {
@valotas
valotas / GrizzlyWebServer.java
Created May 1, 2012
Jersey + Guice + Grizzly
View GrizzlyWebServer.java
public class GrizzlyWebServer {
private static final Logger logger = LoggerFactory.getLogger(GrizzlyWebServerService.class);
public static final void main(String[] args) throws IllegalArgumentException, IOException {
HttpServer server = startWebServer();
System.out.println("Jersey started");
if (logger.isInfoEnabled()) {
logger.info("Jersey web app started with Grizzly web container");
}
View BetterJerseyTest.java
public class BetterJerseyTest extends JerseyTest {
//Fire up jersey with Guice
private static final AppDescriptor APP_DESCRIPTOR = new WebAppDescriptor.Builder("com.some.package.name")
.filterClass(GuiceFilter.class)
.contextPath("jersey-ctx-path")
.servletPath("/")
.clientConfig(new DefaultClientConfig(JacksonJaxbJsonProvider.class))
.build();
You can’t perform that action at this time.