Skip to content

Instantly share code, notes, and snippets.

View davicfg's full-sized avatar
🏠
Working from home

Davi Carvalho davicfg

🏠
Working from home
View GitHub Profile
@sibelius
sibelius / testingConcept.md
Last active February 1, 2024 17:36
testing library concept and basic test

You first need to undestand the concept of frontend tests.

You should not test the implementation but the behavior

You test like the end user

For instance, imagine a login screen with email and password inputs and a submit button

The test should input the email and the password, then click in the submit button.

SPACESHIP_PROMPT_ORDER=(
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
exec_time # Execution time
line_sep # Line break
vi_mode # Vi-mode indicator
@filipelenfers
filipelenfers / installJdkTarGzUbuntu.sh
Last active April 22, 2024 02:02
Install JDK from tar.gz Ubuntu
#Login as root
sudo su
#create jdk directory
mkdir /opt/jdk
#uncompress, change to your file name
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk
#check if files are there
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="persistenceUnitName" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <!-- DB Driver -->
@nicholasess
nicholasess / README
Last active November 23, 2022 00:30
Desafio Angular
Criar uma aplicação com Angular 1.x, que se comunique com a API do github.
A estrutura tem que se basear no modelo MVC, no uso de rotas para acessar subniveis, exemplo:
Usuario
-> repositorios
-> perfil do repositório
-> organizações
Requisitos:
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active May 2, 2024 10:43
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@fbidu
fbidu / monte_carlo.py
Last active February 6, 2023 15:00
Monte Carlo Pi em Python
# -*- encoding: latin-1 -*
# Importando a biblioteca de matematica
import math
# Importando a biblioteca de aleatoriedade
import random
# Inicialmente, não temos nenhum ponto 'dentro' do circulo
pontos_no_circulo = 0
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active May 5, 2024 14:52
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@kelvinst
kelvinst / ruby-meta.md
Last active August 7, 2023 20:49
Metaprogramanção em ruby - o básico

Metaprogramanção em ruby - o básico

Bem, se você é um programador há algum tempo já deve ter ouvido falar sobre metaprogramação. Eu sei, dá três tipos de arrepio só de ouvir o termo. E sim, é uma coisa bem cabeluda, é um recurso muito poderoso e muitas vezes difícil de entender. Mas agora seus problemas acabaram 👍 👍! Vou explicar pra vocês o que é metaprogramação e como fazer isso em ruby!

O que é?

Certo, sobre o termo e o conceito então: metaprogramação é um termo usado para definir um programa, ou uma rotina, que manipula o próprio programa (ou outro, tanto faz) em tempo de execução. Ou seja, um programa que programa. É basicamente um código que permite alterar e criar mais código ao ser executado.

Se você pensar bem sobre esta teoria é bem fácil elencar um metaprograma certo? Consegue adivinhar um tipo de metaprograma que você usa no seu dia a dia? Isso mesmo! Compiladores são metaprogramas! Você deve estar pensando: "Ah, mas um compilar não altera o próprio código, ele só gera nov

@xesscorp
xesscorp / esp8266.ino
Last active December 7, 2021 17:06
This program issues commands to an ESP8266 Wifi module in order to receive an HTML page from a website.
///////////////////////////////////////////////////////////////////////////////////////
// This program uses the ESP8266 Wifi module to access a webpage. It's an adaptation of
// the program discussed at http://hackaday.io/project/3072/instructions
// and shown here http://dunarbin.com/esp8266/retroBrowser.ino .
//
// This program was ported to the ZPUino 2.0, a softcore processor that runs on an FPGA
// and emulates an Arduino.
//
// This program works with version 00160901 of the ESP8266 firmware.
///////////////////////////////////////////////////////////////////////////////////////