Skip to content

Instantly share code, notes, and snippets.

View nicolas-zozol's full-sized avatar
🙂

Nicolas Zozol nicolas-zozol

🙂
View GitHub Profile
@nicolas-zozol
nicolas-zozol / option.ts
Created September 12, 2019 14:30
Optional in typecript
export class Optional<T> {
constructor(public value:T) {
}
isPresent():boolean {
return this.value !== null && this.value !== undefined;
}
map(bindCall):Optional<T> {
@nicolas-zozol
nicolas-zozol / docker-compose.yml
Created January 29, 2020 08:05
Adminer + Postgres docker-compose
---
version: "3.3"
services:
# POSTGRES: https://github.com/docker-library/postgres
db:
image: postgres
container_name: db
#restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
@nicolas-zozol
nicolas-zozol / sonoff.js
Created January 6, 2021 13:20
Sonoff basic javascript code
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
@nicolas-zozol
nicolas-zozol / gist:8bcb215a629488549166059db7d99f35
Created January 14, 2021 09:15
nodejs systemd file config
[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
@nicolas-zozol
nicolas-zozol / .tsx
Created May 17, 2023 07:13
useSize: get responsives sizes inside TSX code with React
/**
* 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'