Skip to content

Instantly share code, notes, and snippets.

View lopezjurip's full-sized avatar
🎯
Focusing

Patricio López Juri lopezjurip

🎯
Focusing
View GitHub Profile
@lopezjurip
lopezjurip / Caddyfile
Last active April 17, 2024 00:03
Fix Too Many Redirect error using Caddy + Cloudflare
www.mysite.com, mysite.com {
proxy / webapp:3000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
gzip
tls your@email.com
}
@lopezjurip
lopezjurip / script.sh
Created September 25, 2016 02:08
Github full code review
# Create empty branch.
git checkout --orphan review
git rm -rf .
git commit --allow-empty -m "Create empty branch"
git push --set-upstream origin review
# Create `project` branch from `master` current state.
git checkout -b project
git merge master --allow-unrelated-histories
git push --set-upstream origin project
@lopezjurip
lopezjurip / example.ts
Last active September 27, 2023 17:22
How to define objects representing webhooks or reducer's actions ( useReducer) as TypeScript definitions to be able to switch/case them up.
/** Action identifiers. */
export const WEBHOOKS_EVENTS = [
"user.created",
"user.updated",
// ...
] as const;
/** Action types. */
export type WebhookEvent = typeof WEBHOOKS_EVENTS[number];
@lopezjurip
lopezjurip / App.tsx
Created December 30, 2020 13:27
React useReducer useContext with Typescript types
import React, { useReducer, useContext, Dispatch } from "react";
import "./styles.css";
// Local types, example: box, product, venue, etc
type MyItem = {
id: number;
name: string;
};
// Reducer types
@lopezjurip
lopezjurip / example.tsx
Last active September 25, 2023 16:52
Tailwind buttons and input plugins (btn-*, input-*)
import { clsx } from "clsx"
export function UserFieldset({ disabled, className, ...props } : React.ComponentProps<fieldset>) {
// fieldset has built-in disabled management for inputs and buttons inside of it.
return (
<fieldset className={clsx("grid grid-cols-1 gap-4", className)} disabled={disabled} {...props}>
<div className="col-span-1">
<label htmlFor="name">Name</label/>
<input id="name" name="name" className={clsx("input input-4 sm:input-3 input-blue", "w-full mt-1")} />
</div>
@lopezjurip
lopezjurip / chocolatey-git-python3.md
Last active September 15, 2023 02:38
Install Chocolatey on Windows 10 | Install git and Python3 (with pip)

Install Chocolatey on Windows 10

First, you have to run Powershell as administrator. Then type the following:

Set-ExecutionPolicy Unrestricted

Accept to continue.

Then we install Chocolatey:

@lopezjurip
lopezjurip / README.md
Last active September 10, 2023 06:27
Write to NTFS on OSX Yosemite and El Capitan

OUTDATED, see comments below

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew formulae:

brew update
@lopezjurip
lopezjurip / pythongitdepth.py
Created October 21, 2015 00:05
GitPython clone with depth
import git
def clone(cls, directory, url, depth=3):
return git.Repo.clone_from(url, directory, depth=depth)
@lopezjurip
lopezjurip / CSharp.sublime-build
Created May 30, 2015 19:00
Sublime Text 3 - C# Build System
{
"shell": true,
"cmd": ["mcs $file ; mono $file_base_name.exe"],
"selector": "source.cs"
}
@lopezjurip
lopezjurip / .vscode extensions.json
Last active November 10, 2022 14:55
Easy Rome Tools setup
{
"recommendations": [
"rome.rome",
]
}