Skip to content

Instantly share code, notes, and snippets.

@lebowvsky
lebowvsky / docker-compose.yml
Last active January 9, 2024 10:23
docker-compose to create container with mysql and phpmyadmin
version: "3"
services:
db:
image: mysql
volumes:
- db_data:/var/lib/mysql
restart: always
@lebowvsky
lebowvsky / docker-compose.yml
Created June 5, 2023 20:04
docker-compose to create container with mariadb and phpmyadmin
version: '3'
volumes:
mariadb:
driver: local
networks:
db:
driver: bridge
version: "2"
services:
app:
image: lebowvsky/cvonline
stdin_open: true # docker run -i
tty: true # docker run -t
networks:
- ubuntu_web
labels:
version: "2"
services:
app:
image: lebowvsky/cvonline
stdin_open: true # docker run -i
tty: true # docker run -t
ports:
- 4000:3000 #Par example
@lebowvsky
lebowvsky / index.ts
Created August 13, 2020 23:03
POO en typescript 1
class Person {
private name: string;
private age: number;
constructor(name: string, age: number) {
this.name = name;
this.age = age;
}
tellMyName(): string {
@lebowvsky
lebowvsky / index.ts
Created August 12, 2020 14:13
installation et utilisation Typescript
import { cpus } from "os";
import chalk from "chalk";
console.log(chalk.red(JSON.stringify(cpus())));
@lebowvsky
lebowvsky / request-url.js
Created June 15, 2020 08:22
JavaScript Asynchrone 1
const request = require('request');
request('https://swapi.dev/api/people/1/', function (error, response, body) {
console.error('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
const luke = JSON.parse(body);
console.log(luke);
request(luke.films[0], function (err, res, bod) {
console.error('error:', err); // Print the error if one occurred
console.log('statusCode:', res && res.statusCode); // Print the response status code if a response was received
@lebowvsky
lebowvsky / index.js
Created June 8, 2020 10:55
Express 6 - get detail
const connection = require("./conf");
const express = require("express");
const app = express();
const port = 3000;
app.get("/api/movies", (req, res) => {
let sql = "SELECT * FROM movie";
let sqlValues = [];
if (req.query.rating && req.query.genre) {
@lebowvsky
lebowvsky / index.js
Created June 2, 2020 11:16
Express 5 - DELETE
const connection = require('./conf');
const express = require('express');
const app = express();
const port = 3000;
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.get('/api/employees', (req, res) => {
@lebowvsky
lebowvsky / index.js
Last active June 2, 2020 11:04
Express 4 - PUT
const connection = require('./conf');
const express = require('express');
const app = express();
const port = 3000;
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.get('/api/employees', (req, res) => {