Skip to content

Instantly share code, notes, and snippets.

View hansfpc's full-sized avatar
🌗
There ain't no such thing as a free lunch.

Hans Piña hansfpc

🌗
There ain't no such thing as a free lunch.
View GitHub Profile
@stolinski
stolinski / Example.tsx
Last active June 8, 2022 05:54
Route Transitions with Framer Motion
const FakeComponent = () => {
return (
<AnimatedRoutes exitBeforeEnter initial={false}>
<RouteTransition exact path="/some-route">
<NewUsers />
</RouteTransition>
<RouteTransition exact path="/yo" >
<Users />
</RouteTransition>
</AnimatedRoutes>
@pixeline
pixeline / readme.md
Created June 1, 2019 11:52
Deploy a "docker-composed" environment on DigitalOcean

Deploy docker-compose on digitalocean

  1. create Docker droplet via digitalocean one-click-app-docker
  2. log into it
  3. generate SSH key
ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa
  1. Copy it
@hansfpc
hansfpc / docker_commands.sh
Last active April 2, 2019 08:15 — forked from santi020k/docker_commands.sh
Comandos básicos de Docker (spanish)
# Notas
containerID # suficiente con los primeros 3 dijitos del id
-it # Modo iterativo
# Comprobar funcionamiento docker
docker -v
# o
docker version
@aquiseb
aquiseb / readme.md
Last active February 28, 2024 00:03

Typescript Cheatsheet

A minimalist typescript cheatsheet to get started quickly

// Install typescript
npm install -g concurrently lite-server typescript

// Run the .ts
tsc typescript-cheatsheet --watch
@hansfpc
hansfpc / semicolons.js
Created June 13, 2018 18:36
What you need to keep not using semicolons in JS.
There are three simple (and similar) rules to remember:
* Don't start a new line with parentheses,
* don't start a new line with a bracket,
* don't start a new line with a backtick.
And that's it.
context: ({ req }) => {
// get the user token from the headers
const token = req.headers.authentication || '';
// try to retrieve a user with the token
const user = getUser(token);
// optionally block the user
// we could also check user roles/permissions here
if (!user) throw new AuthorizationError('you must be logged in');
@trevorgreenleaf
trevorgreenleaf / px-rem-tw.csv
Last active April 1, 2024 15:42
PX to REM'S to TAILWIND CSS
PX REM TW
4 0.25 1
8 0.5 2
16 1 4
32 2 8
48 3 12
64 4 16
80 5 20
96 6 24
112 7 28
@aquiseb
aquiseb / graphql-go-mongodb-example.go
Last active August 7, 2022 23:39
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
// Embedded in this article https://medium.com/p/c98e491015b6
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/graph-gophers/graphql-go"
@felipepastorelima
felipepastorelima / firestore.rules
Last active September 30, 2021 15:11
Firestore Rules utilities to reduce verbosity. Generator: https://scaffoldhub.io/firestore-rules
service cloud.firestore {
match /databases/{database}/documents {
// START - Usage example
match /people/{document=**} {
function propertiesValid() {
return request.resource.data.keys().hasAll(['name', 'birthdate', 'yearsOfExperience'])
&& request.resource.data.size() == 3
&& isString('name') && minlength('name', 3) && maxlength('name', 255)
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active October 14, 2024 15:38
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation