Skip to content

Instantly share code, notes, and snippets.

View pydawan's full-sized avatar

Thiago Monteiro pydawan

View GitHub Profile
const options = { year: "numeric", month: "long", day: "numeric" };
const date = new Date(2020, 11, 31) // 2020-12-31T03:00:00.000Z
console.log(date.toLocaleDateString("pt-br", options))
// 31 de dezembro de 2020
console.log(date.toLocaleDateString("pt-br", { ...options, month: 'numeric'}))
// 31/12/2020
const regex = /^([0-9]{4})[-](0[1-9]|1[0-2])[-](0[0-9]|1[0-9]|2[0-9]|3[0-1])/gm
const dateRx = new Date(2020, 11, 31) // 2020-12-31T03:00:00.000Z
@ishad0w
ishad0w / sources.list
Created April 30, 2020 16:55
Ubuntu 20.04 LTS (Focal Fossa) -- Full sources.list
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
@l0co
l0co / Java8DataTimeCheatSheet.java
Created June 7, 2019 11:59
Cheatsheet of using Java 8 date time
/**
* Here is the jdk8 datetime cheatsheet and explanation why we use ZonedDateTime and Instant in TimeService.
*/
// this is the 01.03.2016 00:00 in server timezone (Europe/Warsaw) == EXACTLY THE SAME AS THE SYSTEM TIME
ZonedDateTime zonedDateTime = ZonedDateTime.of(2016, 3, 1, 0, 0, 0, 0, ZoneId.systemDefault());
System.out.println(zonedDateTime); // 2016-03-01T00:00+01:00[Europe/Warsaw]
// this is the same 01.03.2016 00:00 but doesn't carry timezone information
LocalDateTime localDateTime = zonedDateTime.toLocalDateTime();
@a21ns1g4ts
a21ns1g4ts / zoologicMonitor.html
Last active November 12, 2021 15:58
factory-functions
<script src="zoologicMonitor.js"></script>
<script lang="javascript">
const dog = makeDog(
{
name:"Laio",
id: 1,
}
);
dog.walk()
@fnky
fnky / ANSI.md
Last active October 31, 2025 02:34
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@ChrisTaylorDeveloper
ChrisTaylorDeveloper / vs-code-php-debug-docker-xdebug.md
Last active July 6, 2024 07:40
How to configure the PHP-Debug extension for VS Code when serving the PHP project from Docker with xdebug

The Dockerfile

Only add the xdebug.remote_log line if you need to troubleshoot.

FROM php:7.1-apache

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
@ahmadawais
ahmadawais / VSCode_Node_Babel_Recipe.md
Last active November 1, 2022 11:31
VSCode Node + Babel Recipe | Solves: vscode debug unexpected token import

VSCode Node + Babel Recipe

Debug Modern JavaScript with VSCode. Part of VSCode Course.

1. init a module:

npm init -y
@renatoapcosta
renatoapcosta / rest_modelo_maturidade_richardson.md
Last active February 15, 2024 15:05
Modelo de maturidade Richardson

Modelo de maturidade Richardson

Apesar de Roy Fielding deixar bastante claro que para uma API ser considerada RESTful ela precisa obrigatoriamente seguir todas as constraints definidas em seu trabalho, na prática, muitas vezes precisamos de uma abordagem um pouco mais simples.

Sendo assim, Leonard Richardson propôs um modelo de 4 níveis para que alcancemos uma API REST.

Os níveis 0, 1 e 2 talvez sejam mais familiares, e de fato são mais fáceis de implementar, porém, deve ficar claro que os mesmos não são considerados RESTful.

screen shot 2018-08-12 at 19 56 38

@DrYazid
DrYazid / starulm.md
Last active December 5, 2024 00:44
StarUml 3.0 full version

StarUML 3.0

  • 1- install staruml. : staruml
  • 2- install node.js : node.js
  • 3- go to ...\AppData\Local\Programs\StarUML\resources
  • 4- open CMD As admin
  • 5- execute
@tvinke
tvinke / GroovyAnsi.groovy
Created April 18, 2018 14:21
Simple ANSI colors in the terminal written in Groovy
// Ansi colors in Groovy
// Author: Ted Vinke
import static Ansi.*
println color("BOLD", Ansi.BOLD)
println color("ITALIC", Ansi.ITALIC)
println color("UNDERLINE", Ansi.UNDERLINE)
println color("BLINK", Ansi.BLINK)
println color("RAPID_BLINK", Ansi.RAPID_BLINK)
println color("REVERSE_VIDEO", Ansi.REVERSE_VIDEO)