Skip to content

Instantly share code, notes, and snippets.

@cluelessjoe
cluelessjoe / notesDuWorkshopDecouverteDeElm.md
Created May 16, 2018 22:43
Notes du workshop Découverte de Elm

Notes du workshop Découverte de Elm

Le workshop elm était très sympa, le présentateur, Jordane, est très bon et son tuto par étapes est très bien fait, détaillé et interactif (faisable en solitaire aussi).

Elm

  • no runtime exception: if it compiles, then it works!
    • il n'est pas possible d'avoir des exceptions
      • division by 0 -> Infinity
      • fonctions obligatoirement pures
  • if toujours avec un else
@cluelessjoe
cluelessjoe / spaCriterion.md
Last active April 13, 2018 21:11
Choice of full stack SPA framework: some of my criterion

Choice of full stack SPA framework: some of my criterion

Orthogonality of css/html/js/build

  • each should be upgradable without impacting the other
    • otherwise plan for quite some yak shaving once you need to update one of these bits
  • style and code are 2 distinct things

Web proximity

  • other css/js should be easily usable
  • push/notification/dynamic content should all be possible
package fr.bl.interop.messaging.database.consumption.simple
object StringCalculator {
def compute(s: String): Long = {
val userDelimiter: Option[String] = if (s.startsWith("//")) Some(s.substring(2, s.indexOf("\n"))) else None
def go(acc: Long, leftToAdd: String): Long = {
if (leftToAdd.isEmpty) 0
else {
String initialFieldName = "text";
Schema oneFieldSchema = SchemaBuilder.builder()
.record("OneFieldSchema").namespace("avro.trial")
.fields()
.name(initialFieldName).type().stringType().noDefault()
.endRecord();
Schema oneFieldSchemaWithRenamedFieldAndAlias = SchemaBuilder.builder()
.record("AliasedOneFieldSchema").namespace(oneFieldSchema.getNamespace()).aliases("avro.trial.OneFieldSchema")
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.Test;
public class LambdaTypeBugTest {
public interface BarInterface {
String convertToString();
}
@cluelessjoe
cluelessjoe / gist:d9a9f94dc2bcd7e930f1
Last active October 7, 2015 15:40
Java: lambda compiling but crashing VM
code to reproduce
=================
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.Test;
public class LambdaTypeBugTest {
public interface BarInterface {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
String m = method.getName();
if (log.isDebugEnabled()) {
log.debug("XML event: " + m);
}
// Needs to be BEFORE the actual event, so that for instance the
// sequence writeStartElem, writeAttr, writeStartElem, writeEndElem,
// writeEndElem
// is correctly handled
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
)
func main() {