Skip to content

Instantly share code, notes, and snippets.

View pedrobertao's full-sized avatar
🚀

Pedro Bertao pedrobertao

🚀
View GitHub Profile
@bartholomej
bartholomej / css-media-queries-cheat-sheet.css
Last active June 14, 2024 08:20
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@mort3za
mort3za / git-auto-sign-commits.sh
Last active May 28, 2024 20:51
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@gbraad
gbraad / README.md
Last active June 19, 2024 01:24
Buy Me a Coffee

Buy Me a Coffee

Using inlined HTML

Buy Me A Coffee

<a href="https://www.buymeacoffee.com/gbraad" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
@montanaflynn
montanaflynn / main.go
Last active May 28, 2024 04:32
Gin request timeout middleware and handler
package main
import (
"context"
"log"
"net/http"
"time"
"github.com/gin-gonic/gin"
)
@pedrobertao
pedrobertao / gqlRawReq.go
Last active September 17, 2022 11:58
Raw HTTP request to a GraphQL server
package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"net/http"
"os"
"time"
package main
import (
"log"
"reflect"
"os"
)
// Find an object in a slice comparing a KEY (string) and its VALUE (interface{})
func findByKey(objArr interface{}, key string, value interface{}) interface{} {
package main
import "fmt"
type Person struct {
Name string
Surname string
}
func main() {
/*
How to use context with timeout to cancel a slow operation.
The same concept can be used with context.WithDeadline()
*/
package main
import (
"context"
"fmt"
"time"
@pedrobertao
pedrobertao / retryclosure.go
Created January 15, 2021 00:43
Function retrier using closure
/*
Retry function using closure
*/
package main
import (
"errors"
"fmt"
"time"
)
@pedrobertao
pedrobertao / any.go
Last active July 10, 2023 00:06
This is a simple example to use ANY in golang which is an alias for interface{}, therefore easy to read
#################################################
## EXAMPLE OF USAGE OF ANY IN AN OBJECT/STRUCT ##
#################################################
package main
import "fmt"
const (
MALE string = "male"
FEMALE string = "female"