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
// Define the shape of your safe action result. | |
export interface ActionResult<T> { | |
// When execution is successful, data contains the result. | |
data?: T; | |
// Optional error information when input validation fails. | |
validationErrors?: Record<string, any>; | |
// Optional error information when bound arguments validation fails. | |
bindArgsValidationErrors?: Record<string, any>; | |
// Optional error information when the server code throws. | |
serverError?: any; |
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
/* | |
I want a discriminate for post (or product) so that we don't look into a database: | |
Also '/learn' is the equivalent of '/blog'. It's a parameter named homeUrl | |
We have 3 discriminant for routes: | |
- locale. If empty, 'en'. Can be 'fr'. | |
- categories : ['blockchain'] or ['blockchain','security'] : can be undefined for blogroll | |
- page/number : Blog roll current page | |
- /s/slug : last part of the url, if present ; /s/ precises there will be a slug (s for slug) |
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
/** | |
* This custom hook is used to get the size of the screen and creates | |
* a context to share the size with all the components. | |
*/ | |
import React, { FC, useEffect, useState } from 'react' | |
export const tabletSize = '634px' | |
export const desktopSize = '1206px' |
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
[Unit] | |
Description=My app | |
After=syslog.target | |
[Service] | |
User=www-data | |
Type=simple | |
ExecStart=/home/myuser/mywebsite/node_modules/next/dist/bin/next start -p $PORT | |
SuccessExitStatus=130 | |
RestartSec=3 | |
Restart=on-failure |
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
require('dotenv').config() | |
const ewelink = require('ewelink-api') | |
const credentials = { | |
username: process.env.EMAIL, | |
password: process.env.PASSWORD | |
} | |
const devices = { | |
lili: process.env.LILI // device Id |
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
--- | |
version: "3.3" | |
services: | |
# POSTGRES: https://github.com/docker-library/postgres | |
db: | |
image: postgres | |
container_name: db | |
#restart: always | |
environment: | |
POSTGRES_USER: ${POSTGRES_USER} |
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
export class Optional<T> { | |
constructor(public value:T) { | |
} | |
isPresent():boolean { | |
return this.value !== null && this.value !== undefined; | |
} | |
map(bindCall):Optional<T> { |
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
"rules": { | |
"no-consecutive-blank-lines": true, | |
"interface-over-type-literal": false, | |
"trailing-comma":false, | |
"object-literal-sort-keys":false, | |
"member-access":false, | |
"interface-name":false, | |
"arrow-parens":false | |
}, |
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
// Using media-query to generate some common hide/show css classes. | |
// Work in Progress, works with my projects. | |
// !important is sometimes needed with bootstrap, you should try to remove it first. | |
// Most of the time, I just pick one between laptop or desktop | |
// Extra small screen / phone ; | |
$mobileMax: 480px; | |
// Small screen / tablet | |
$tabletMax: 850px; | |
// laptops : |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence xmlns="http://java.sun.com/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" | |
version="2.0"> | |
<persistence-unit name="funkopop" transaction-type="RESOURCE_LOCAL"> | |
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> | |
<properties> | |
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/funkopop" /> | |
<property name="javax.persistence.jdbc.user" value="admin" /> |
NewerOlder