Skip to content

Instantly share code, notes, and snippets.


Patricio López Juri lopezjurip

View GitHub Profile
lopezjurip /
Created Sep 25, 2016
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 / Caddyfile
Last active Nov 17, 2021
Fix Too Many Redirect error using Caddy + Cloudflare
View Caddyfile, {
proxy / webapp:3000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
lopezjurip /
Last active Oct 13, 2021
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 / gist:cd92f879bc92af698f85ad0433a953cd
Created Mar 29, 2021
Migrate Postgres string field to integer if present else null
View gist:cd92f879bc92af698f85ad0433a953cd
ALTER TABLE "public"."usage_stats"
ALTER COLUMN "resSize" TYPE INT USING CASE WHEN "resSize" ~ '^[-+0-9]+$' THEN "resSize"::integer ELSE NULL END;
lopezjurip / CSharp.sublime-build
Created May 30, 2015
Sublime Text 3 - C# Build System
View CSharp.sublime-build
"shell": true,
"cmd": ["mcs $file ; mono $file_base_name.exe"],
"selector": "source.cs"
lopezjurip / App.tsx
Created Dec 30, 2020
React useReducer useContext with Typescript types
View App.tsx
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 / gist:c509eadf1e31b45825a9
Created Feb 10, 2015
Create Doorkeeper authorization via rails console
View gist:c509eadf1e31b45825a9
app = Doorkeeper::Application.create!(:name => 'myapp', :redirect_uri => 'myapp://oauth/callback')
lopezjurip / gist:a817e96ec833e7667274
Last active Jun 9, 2020
View gist:a817e96ec833e7667274
# Based on:
# Add to gemfile:
ruby '2.1.2'
gem 'pg'
gem 'puma'
gem 'rails_12factor'
gem 'searchkick'
gem 'typhoeus'
lopezjurip / Dockerfile
Last active May 28, 2020
A great Dockerfile for Node.js with Typescript and Yarn (multi-step build) and NPM Token for private modules
View Dockerfile
# First stage: prepare image
FROM node:12-alpine AS base
ARG WORKDIR=/usr/src/app
# Install container build dependencies
RUN apk --no-cache add g++ ca-certificates lz4-dev musl-dev openssl-dev \
make python gcc zlib-dev libc-dev bsd-compat-headers py-setuptools git bash
lopezjurip / gitlab-ci.yml
Created May 23, 2020
pipenv, zappa and Gitlab CI
View gitlab-ci.yml
image: python:latest
- deploy
WORKON_HOME: .pipenv/venvs
PIP_CACHE_DIR: .pipenv/pipcache