Skip to content

Instantly share code, notes, and snippets.

View exaucae's full-sized avatar

Chrys Exaucet exaucae

View GitHub Profile
@exaucae
exaucae / usePosition.js
Created November 9, 2021 22:53
React hook that retrieves current user position
import React, {useState} from 'react'
const useLocation = () => {
const initialState = {
latitude: '',
longitude: '',
error: '',
@exaucae
exaucae / .env
Created October 28, 2021 20:00
traccar docker setup
MYSQL_ROOT_PASSWORD=traccar
MYSQL_ROOT_HOST='%'
MYSQL_DATABASE=traccar
MYSQL_USER=traccar
MYSQL_PASSWORD=traccar
@exaucae
exaucae / AbstractWebSocketClientAdapter.java
Created September 28, 2021 00:37
Websocket over Stomp Java client config
package client.websocket.adapter.parent;
import com.google.gwt.user.client.Window;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter;
@exaucae
exaucae / react-router.md
Last active September 15, 2021 14:43
React unit testing tricks
// Unit testing react-router 

// pay attention to write it at your test file top level
const mockedUsedNavigate = jest.fn();

jest.mock('react-router-dom', () => ({
   ...jest.requireActual('react-router-dom') as any,
 useNavigate: () => mockedUsedNavigate,
@exaucae
exaucae / pgR2dbcConfig.java
Created August 31, 2021 14:31
postgres springboot reactive config for r2dbc
package your.pkg;
import io.r2dbc.postgresql.PostgresqlConnectionConfiguration;
import io.r2dbc.postgresql.PostgresqlConnectionFactory;
import io.r2dbc.spi.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration;
import org.springframework.data.r2dbc.core.DefaultReactiveDataAccessStrategy;
@exaucae
exaucae / mvn-uber-jar-plugins.xml
Created August 31, 2021 14:23
maven plugins to fat jar your project
<!-- https://stackoverflow.com/questions/20801874/how-to-build-an-executable-jar-from-multi-module-maven-project/20802018#20802018 -->
<!-- https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven?page=1&tab=votes#tab-top -->
<build>
<plugins>
<!-- mvn package -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
@exaucae
exaucae / odoo-models.txt
Last active May 26, 2021 14:48
notes about Odoo structure
========================
ODOO building blocs
==============
I expose Odoo 14 models structure here. Have a look to reference for further informations.
1. Models: represents a business object
They are built around three main base ORM classes BaseModel, AbstractModel and Model
Models are not directly accessible; one should use recordsets to do so.
@exaucae
exaucae / grid-layout.html
Created May 5, 2021 13:01
css grid layout template
<!DOCTYPE html>
<html>
<head>
<style>
.item1 { grid-area: header; }
.item2 { grid-area: sidebar; }
.item3 { grid-area: main; }
.item4 { grid-area: aside; }
.item5 { grid-area: footer; }
@exaucae
exaucae / browser-engines
Last active May 5, 2021 10:11
guide to different browser engines
Every browser is backed by a rendering engine to draw the HTML/CSS web page.
- Firefox → Gecko
- Safari → WebKit
- Chrome → Blink (a fork of Webkit).
- Opera → Blink (no longer uses Presto since Feb 2013)
- IE → Trident (discontinued)
- Edge → EdgeHTML (clean-up fork of Trident) (Edge switched to Blink in 2019)
css prefixes:
@exaucae
exaucae / flexbox.txt
Last active May 5, 2021 10:53
flexbox ressources
Flexbox layout is most appropriate to the components of an application, and small-scale layouts,
while the Grid layout is intended for larger scale layouts.
The main idea behind the flex layout is to give the container the ability to alter its items’ width & height (and order)
to best fill the available space.
shorthand properties:
- flex: [flex-grow] [flex-shrink] [flex-basis];
- flex-flow: [flex-direction] [flex-wrap]
References: