Skip to content

Instantly share code, notes, and snippets.

View wenzhihong2003's full-sized avatar

tom.wen wenzhihong2003

View GitHub Profile
@moscas
moscas / CSV-ToOneRow-Groovy.csv.groovy
Last active April 5, 2022 10:43
DataGrip extractors
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@spullara
spullara / App.java
Created January 6, 2013 20:48
JDK8 is going to be great. Webbit is also really nice (based on Netty).
package webserver;
import org.webbitserver.WebServers;
public class App {
public static void main(String[] args) {
WebServers.createWebServer(8080).add((req, res, con) -> {
res.content("Hello, world!").end();
}).start();
}
@wenzhihong2003
wenzhihong2003 / gist:3126298
Created July 17, 2012 01:15 — forked from sadache/gist:3026886
Bits'bout Play2 Architecture

Bits'bout Play2 Architecture

Play2 Simple HTTP API

Essential blueprint of Play2 architecture is pretty simple and it should be easy to explain in a fairly short blog post. The framework can be understood progressively at different levels; each time having better exposure to some aspects of its design.

The core of Play2 is really small, surrounded by a fair amount of useful APIs, services and structure to make Web Programming tasks easier.

Basically, Play2 is an API that abstractly have the folllowing type

@sadache
sadache / AA.md
Created July 8, 2012 21:29
Is socket.push(bytes) all you need to program Realtime Web apps?

Is socket.push(bytes) all you need to program Realtime Web apps?

One of the goals of Play2 architecture is to provide a programming model for what is called Realtime Web Applications.

Realtime Web Applications

Realtime Web Applications are applications that make use of Websockets, Server Sent Events, Comet or other protocols offering/simulating an open socket between the browser and the server for continuous communication. Basically, these applications let users work with information as it is published - without having to periodically ping the service.

There are quite a few web frameworks that target the development of this type of application: but usually the solution is to simply provide an API that allows developers to push/receive messages from/to an open channel, something like:

# Application dependencies
require:
- com.gelinsoft -> app-base 1.3.2
- com.gelinsoft -> config 1.2.2
- com.gelinsoft -> betterlogs 1.2i
- com.gelinsoft -> aaa 1.2j
# - play -> rythm 1.0.0-RC6
- com.gelinsoft -> rythm 1.0.0-20120615
#- play -> morphia 1.2.8-RC1
@greenlaw110
greenlaw110 / gelin-common-play-modules.yml
Last active December 5, 2023 02:36
Green's common Play modules
# Application dependencies
require:
- com.greenlaw110 -> app-base 2.1.3
- com.greenlaw110 -> play-excel 1.2.3
- com.greenlaw110 -> config 1.2.2
- com.greenlaw110 -> betterlogs 1.2j
- com.greenlaw110 -> aaa 2.1
- com.greenlaw110 -> play-rythm 1.0.1-b3
- com.greenlaw110 -> morphia 1.5.0a
@wendal
wendal / MethodParamNamesScaner.java
Created March 10, 2012 15:15
获得方法形参名称列表(Java)
package org.nutz.lang.util;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
@cgbystrom
cgbystrom / LatencySimulatorHandler.java
Created October 31, 2011 14:50
Netty event latency simulator
import org.jboss.netty.channel.*;
import org.jboss.netty.util.HashedWheelTimer;
import org.jboss.netty.util.Timeout;
import org.jboss.netty.util.Timer;
import org.jboss.netty.util.TimerTask;
import java.util.concurrent.TimeUnit;
/**
* Simulates latency of Netty events