Skip to content

Instantly share code, notes, and snippets.

View DouglasdeMoura's full-sized avatar

Douglas Moura DouglasdeMoura

View GitHub Profile
@DouglasdeMoura
DouglasdeMoura / quotes
Last active June 24, 2022 23:45
Quote for my random quotes generator
[
{
"text": "Life isn’t about getting and having, it’s about giving and being.",
"author": "Kevin Kruse"
},
{
"text": "Whatever the mind of man can conceive and believe, it can achieve.",
"author": "Napoleon Hill"
},
{
@DouglasdeMoura
DouglasdeMoura / .eslintrc.js
Created March 29, 2022 16:12
My ESLint config
module.exports = {
env: {
browser: true,
node: true,
},
settings: {
react: {
version: 'detect',
},
node: {
@DouglasdeMoura
DouglasdeMoura / input.spec.tsx
Last active February 15, 2022 11:31
Simple React Input validation
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { Input } from '.'
describe('<Input />', () => {
it('should render the component', () => {
render(<Input label="mock_label" />)
expect(screen.getByLabelText('mock_label')).toBeInTheDocument()
@DouglasdeMoura
DouglasdeMoura / .editorconfig
Last active September 7, 2021 15:08
React template
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
@DouglasdeMoura
DouglasdeMoura / styles.css
Last active February 17, 2021 18:13
Tailwind CSS colors as CSS variables (v2.0.3)
:root {
--color-blue-gray-50: #F8FAFC;
--color-blue-gray-100: #F1F5F9;
--color-blue-gray-200: #E2E8F0;
--color-blue-gray-300: #CBD5E1;
--color-blue-gray-400: #94A3B8;
--color-blue-gray-500: #64748B;
--color-blue-gray-600: #475569;
--color-blue-gray-700: #334155;
--color-blue-gray-800: #1E293B;
@DouglasdeMoura
DouglasdeMoura / converter.fish
Last active January 17, 2021 18:03
Converting image to base64 on Linux
bash { echo "data:image/png;base64,"; openssl enc -base64 -in src/pages/Index/images/input.png; } > output.b64
# Remove new lines
echo (tr -d "\n\r" < output.b64) >> output_without_new_lines.b64
@DouglasdeMoura
DouglasdeMoura / dev-environment.sh
Last active February 26, 2021 12:00
Script to install my development tools on fresh Ubuntu installations
#!/bin/sh
# Add fish PPA
sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
# Install minimal tools
sudo apt install fish git dirmngr gpg vim -y
# Set fish as default shell
@DouglasdeMoura
DouglasdeMoura / bookmarklet.js
Last active October 25, 2020 15:27
Control YouTube playback rate
/*
* JAVASCRIPT BOOKMARKLET
*
* In order to have this function always at hand and use it in
* any website, just add the code below to a bookmark in your favorite browser.
* Every time you click it, the browser will prompt you for a new playback
* rate for first video in the page.
*/
javascript:(function() {
@DouglasdeMoura
DouglasdeMoura / keybindings.ahk
Created May 27, 2019 19:15
AutoHotKey Script for whom got used to Dell's laptops Fn + Arrow behavior
#Right::Send {End} ; Windows + Right Arrow = End
#Left::Send {Home} ; Windows + Right Arrow = Home
#+Right::Send +{End} ; Windows + Right Arrow + Shift = Select to the End
#+Left::Send +{Home} ; Windows + Right Left + Shift = Select to the Home
@DouglasdeMoura
DouglasdeMoura / custom_query.php
Last active October 23, 2017 18:48
Executar WP_Query randomicamente a cada 30 minutos
<?php
$cache_key = 'categoria-da-home';
if ( ! $ids = get_transient( $cache_key ) ) {
//Essa query pega apenas os IDs dos posts
$query = new WP_Query( [
'fields' => 'ids',
'posts_per_page' => 15,
'cat' => 5, //ID da categoria