This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function retrieveDB(){ | |
return new Promise(resolve => { | |
const request = window.indexedDB.open("firebaseLocalStorageDb", 1); | |
request.onerror = function(event) { | |
console.log("Erreur lors de l'ouverture de la base de données."); | |
}; | |
request.onsuccess = function(event) { | |
resolve(event.target.result); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read inputs from System.in, Write outputs to System.out. | |
// Your class name has to be Solution | |
import java.util.*; | |
import java.io.*; | |
import java.math.*; | |
class Solution { | |
public static void main(String args[]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.TimeUnit; | |
import java.util.function.Supplier; | |
import java.util.stream.IntStream; | |
/** | |
* I tried to compare Java 7 and Java 8 (functional way) syntax on a small problem. | |
* I Also compare performances just for fun. | |
*/ | |
public class Exercice6 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fr.ybo.javaquiz; | |
public class Singleton { | |
private static final Singleton INSTANCE = new Singleton(); | |
public static Singleton getInstance() { | |
return INSTANCE; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.vertx.core.Vertx | |
import io.vertx.ext.web.Router | |
import io.vertx.ext.web.handler.BodyHandler | |
fun main(args: Array<String>) { | |
val vertx = Vertx.vertx() | |
val router = Router.router(vertx) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unzip -p *.gtfs.zip stops.txt | | |
tr -d '"' | | |
tail -n+2 | | |
awk -F "," 'BEGIN{minLat=100; maxLat=-100; minLon=100; maxLon=-100 }{ if ( $5 > maxLat ) maxLat=$5; if ( $5 < minLat ) minLat =$5; if ($6 < minLon) minLon=$6; if ($6 > maxLon) maxLon = $6 }END {print minLat" "minLon" "maxLat" "maxLon}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<div id="app"></div> | |
<script src="https://unpkg.com/react/dist/react.min.js" type="text/javascript"></script> | |
<script src="https://unpkg.com/react-dom/dist/react-dom.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
(function() { | |
var h = React.createElement; | |
var Hello = React.createClass({ | |
render: function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.from(document.querySelectorAll('.message')) | |
.map(message => message.querySelector('.body')) | |
.forEach(message => { | |
message.innerHTML = message.innerHTML.split(/ /).map(function (part, index) { | |
if (part && part.length && part.length > 0) { | |
var codeMatch = part.match(/(?:```(\w*)[\n ]?([\s\S]*?)```+?)|(?:`(?:[^`]+)`)/); | |
var imgHrefMatch = part.match(/href=/i); | |
if (!codeMatch && !imgHrefMatch) { | |
return part.replace(/(https?:\/\/.*\.(?:png|jpeg|jpg|gif))/i, '<img src="$1" />'); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Optional; | |
import java.util.TreeMap; | |
import java.util.function.BinaryOperator; | |
public class TemporelMap<K extends Comparable<K>, V> { | |
private TreeMap<K, V> treeMap = new TreeMap<>(); | |
private BinaryOperator<V> add; | |
public TemporelMap(BinaryOperator<V> add) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jsonp("CALLBACK", "/jsonp", (param, routeParams) -> new Response<>("Hello World")); | |
get("/resource", (param, routeParams) -> new Response<>("Hello World")); | |
get("/resource/:name", Void.class, (param, routeParams) -> { | |
if (routeParams.getParam("name").equals("notfound")) { | |
throw new HttpErrorException(404); | |
} | |
return new Response<>("Hello " + routeParams.getParam("name")); | |
}); |
NewerOlder