Skip to content

Instantly share code, notes, and snippets.


Arnaud Esteve aesteve

  • Lille
Block or report user

Report or block aesteve

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
aesteve /
Last active Jan 18, 2016
What is flux

Flux is an architecture to help client-side application deal with data coming from several endpoints (API endpoints, websockets, user interaction, etc.).

The basic idea is that you're connecting to many endpoints, and when your "connectors" catch a new piece of data, they're dispatching actions (through a dispatcher).

Reducers are listening to these actions. When they catch an event they're interested in (let's say UserReducer catches an USER_DATA_UPDATED event), they "do something" with the action. Most often, they're just storing the data attached to the action somewhere, and returning their new "state". (their state represent a portion of the global store).

Components (views, basically), on the other hand, can be connected to many reducers (or to the whole store). Thanks to a pure function (connect), you'll describe what the component properties will be for a given state of the global store. Let's say your component only needs some users data and not pricing info for instance. You'll c

aesteve / intercept.groovy
Created Jan 11, 2016
Standard interceptors ?
View intercept.groovy
class Decorated {
def intercepted(String something) {
println "within method"
class MyInterceptor implements Interceptor {
aesteve / removeChar.groovy
Created Jan 8, 2016
"Write a method which will remove any given character from a String"
View removeChar.groovy
// "Write a method which will remove any given character from a String"
// The method will be the 'minus' method 'some string ' - 's' == 'ome tring'
def check() {
assert 'some string' - 's' == 'ome tring'
assert '' - 'a' == ''
assert 'something else' - 'z' == 'something else'
// Easy one
View palindrom.groovy
CharSequence.metaClass.getLowerStripped = {
delegate.toLowerCase().replaceAll(/\s/, '')
def check() {
assert !''.palindrom
assert !'palindrom'.palindrom
assert 'madam'.palindrom
assert 'Evil is a name of foeman as I live'.palindrom
aesteve / fizzbuzz.groovy
Last active Jan 8, 2016
FizzBuzz with meta-programming (for fun only)
View fizzbuzz.groovy
Integer.metaClass.getBuzzOrFizz = {
String str= ''
if (delegate % 3 == 0) {
str += 'Fizz'
if (delegate % 5 == 0) {
str += 'Buzz'
if (!str) {
return delegate.toString()
aesteve / profile
Created Jan 1, 2016
add JAVA_HOME (/etc/profile)
View profile
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:bin/javac::")
aesteve / MyAsyncTest.groovy
Created Dec 31, 2015
async bdd unit runner
View MyAsyncTest.groovy
class MyAsyncSpec {
void asyncTestRequest(TestContext context) {
// startsWith async => creates context.async()
def client
setup {
client = vertx.createHttpClient(...)
when {
public static authorize(JsonObject authInfo, Handler<User> onAuthorized, Handler<Throwable> onFailure) {
return res -> {
if (res.succeeded()) {
User user = res.result();
user.isAuthorised("newsletter:edit:13", res2 -> {
if (res2.succeeded()) {
boolean hasPermission = res2.result();
View GroovyTestBase.groovy
import io.vertx.core.Handler
import io.vertx.groovy.ext.unit.Async
import io.vertx.groovy.ext.unit.TestContext
import io.vertx.groovy.ext.unit.junit.VertxUnitRunner
import org.junit.runner.RunWith
abstract class GroovyTestBase {
public GroovyTestBase() {
aesteve / Perf example
Created Jul 10, 2015
Some example on what we could benchmark
View Perf example
// create an object
public class SomeObject {
public Date someDate;
public Integer someInt;
public String someString;
public Double someDouble;
// create vertx handler
router.put("/vertx", ctx -> {
You can’t perform that action at this time.