Skip to content

Instantly share code, notes, and snippets.

View pedrobritto's full-sized avatar

Pedro Britto pedrobritto

View GitHub Profile
@eonist
eonist / Markdown-Instructions-for-AI--and-humans.md
Created April 30, 2025 16:29
Best Practice Guidelines for Prompt Markdown Instructions (.md Files)

Best Practice Guidelines for Prompt Markdown Instructions (.md Files)

When creating Markdown (.md) files to standardize prompt instructions or best practices, clarity, consistency, and structure are paramount. Below is a comprehensive guideline on how to structure these files and what to do-and avoid-when authoring them.


Key Principles

  • Clarity: Use Markdown to make prompts and instructions easy to read, both for humans and AI models[6][8].
  • Consistency: Stick to a single Markdown flavor (e.g., CommonMark, GitHub Flavored Markdown) throughout your project[5].
@leosh1d
leosh1d / deferedPersist.ts
Created December 23, 2022 22:17
Zustand (^4.1.5) persist middleware with deferred hydration.
import { persist, PersistOptions } from "zustand/middleware"
import { StateCreator, StoreApi, StoreMutatorIdentifier } from "zustand/vanilla"
type DeferredPersistOptions<S extends object> = PersistOptions<S> & {
hydrateOnResolve?: Promise<void>
}
const DEFAULT_GET_STORAGE = () => localStorage
export default function deferredPersist<
@rishitells
rishitells / Jest_GitLab_CI.md
Last active October 16, 2025 10:06
Setting up Jest tests and coverage in GitLab CI

Configuring Jest Tests in GitLab CI

1. Add GitLab CI configuration file in the root

In the root of your project, add .gitlab-ci.yml with the configuration below.

image: node:latest

stages:
@mvaneijgen
mvaneijgen / docker-compose.yml
Last active July 23, 2018 00:23
Basic docker Wordpress setup with persing database (don't know where it is stored) and persisting Wordpress root and phpMyAdmin running
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@izy521
izy521 / objectdeepcopy.js
Created July 30, 2016 17:28
`JSON.parse( JSON.stringify( obj) )` has been regarded as the fastest method for deep copying Objects, but is it? This is mainly just to test. Obviously Functions aren't allowed in JSON.
var Types = new Map();
Types.set(Array, function(v) {
var l = v.length; i = 0, a = Array(l);
for (i; i<l; i++) {
a[i] = v[i];
}
return a;
});
Types.set(Number, function(v) {
return v * 1;
@rafaelstz
rafaelstz / get.js
Last active February 8, 2026 16:32
AJAX GET and POST with pure Javascript
// Exemplo de requisição GET
var ajax = new XMLHttpRequest();
// Seta tipo de requisição e URL com os parâmetros
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true);
// Envia a requisição
ajax.send();
// Cria um evento para receber o retorno.
@kelvinst
kelvinst / git-aliases.md
Last active February 14, 2026 15:07
Git alias - seja rápido, seja breve!

Git alias - seja rápido, seja breve!

Git freak como sou, precisava compartilhar algo útil sobre ele, claro. E, já que não vejo muito por aí o pessoal usando, resolvi falar dos alias do git! É um recurso que eu uso muito, e nunca entendi porque muitas pessoas não são adeptas. 😕

Pelo nome você já deve perceber que os alias no git são atalhos. Atalhos pro quê? São atalhos para comandos do git e até comandos shell se você quiser. E é bem fácil cadastrar um alias:

$ git config --global alias.st status
@netpoetica
netpoetica / Setting up Nginx on Your Local System.md
Last active November 13, 2024 17:24
Setting up Nginx on Your Local System

#Setting up Nginx on Your Local System ###by Keith Rosenberg

##Step 1 - Homebrew The first thing to do, if you're on a Mac, is to install homebrew from http://mxcl.github.io/homebrew/

The command to type into terminal to install homebrew is:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@magnetikonline
magnetikonline / precompresscssjswebfont.sh
Last active September 19, 2024 17:27
Recursively pre-compress (gzip) CSS/JavaScript/webfont assets for use Nginx and its HttpGzipStaticModule module.
#!/bin/bash -e
function compressResource {
gzip --best --stdout "$1" >"$1.gz"
touch --no-create --reference="$1" "$1.gz"
echo "Compressed: $1 > $1.gz"
}
function main {
@tvpmb
tvpmb / US State List
Created February 7, 2013 22:10
JSON Array with List of US States with 2-char ISO codes.
[
{"name":"Alabama","alpha-2":"AL"},
{"name":"Alaska","alpha-2":"AK"},
{"name":"Arizona","alpha-2":"AZ"},
{"name":"Arkansas","alpha-2":"AR"},
{"name":"California","alpha-2":"CA"},
{"name":"Colorado","alpha-2":"CO"},
{"name":"Connecticut","alpha-2":"CT"},
{"name":"Delaware","alpha-2":"DE"},
{"name":"District of Columbia","alpha-2":"DC"},