Skip to content

Instantly share code, notes, and snippets.

View lopezjurip's full-sized avatar

Patricio López Juri lopezjurip

View GitHub Profile
lopezjurip /
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 /
Last active May 23, 2024 17:29
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 / Caddyfile
Last active April 27, 2024 23:19
Fix Too Many Redirect error using Caddy + Cloudflare, {
proxy / webapp:3000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
lopezjurip /
Created September 26, 2015 12:13
OSX Homebrew: docker-machine setup


Make sure you have installed Homebrew and (Homebrew-Cask)[].

# Install Homebrew
ruby -e "$(curl -fsSL"

# Install Homebrew-cask
brew install caskroom/cask/brew-cask
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 = [
// ...
] as const;
/** Action types. */
export type WebhookEvent = typeof WEBHOOKS_EVENTS[number];
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 / 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")} />
lopezjurip /
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"

Update Homebrew formulae:

brew update
lopezjurip /
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 / 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"