Skip to content

Instantly share code, notes, and snippets.

View juanlatorre's full-sized avatar

Juan Latorre juanlatorre

View GitHub Profile
@juanlatorre
juanlatorre / curl.sh
Created May 5, 2021 00:09 — forked from exAspArk/curl.sh
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep 'Access-Control-Allow-Origin'
@juanlatorre
juanlatorre / ract-dropzone-image.js
Last active April 30, 2021 21:07 — forked from schabluk/ract-dropzone-image.js
React-Dropzone get image width, height and base64 data
const onDrop = useCallback((acceptedFiles) => {
const file = acceptedFiles.find(f => f)
const i = new Image()
i.onload = () => {
let reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = () => {
console.log({
src: file.preview,

Tiny wrapper component for React-Datepicker to stylistically fit with Chakra-UI 1.x.

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} />

Clearable version:

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} isClearable={true} />
diff --git a/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js b/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js
index f64ed90..af3e367 100644
--- a/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js
+++ b/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js
@@ -119,9 +119,18 @@ export class ToastManager extends React.Component {
var position = getToastPosition(prevState, id);
if (!position) return prevState;
return _extends({}, prevState, {
- [position]: prevState[position].map(toast => _extends({}, toast, {
- requestClose: toast.id === id ? true : toast.requestClose
@juanlatorre
juanlatorre / adb.md
Last active July 29, 2020 18:31
Fix ADB version not matching
$ adb kill-server
$ sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin/adb
$ sudo chmod +x /usr/bin/adb
$ adb start-server
@juanlatorre
juanlatorre / particles.json
Created May 14, 2020 04:40
JSON config for particles.json
{
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
@juanlatorre
juanlatorre / README-Template.md
Created February 13, 2020 19:21 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

const imageData = [ 'image1.png', 'img2.png', 'img3.png' ];
const currentImage = 0;
const handleImageChange = (direction) => {
if (direction == 'forward')
currentImage = (currentImage + 1) % imageData.length;
else
currentImage = (currentImage - 1 + imageData.length) % imageData.length;
}
@juanlatorre
juanlatorre / iterifyArray.js
Last active June 21, 2019 16:53
wrapper to add .next() and .prev() and current() to array, without prototype
const iterifyArr = function(arr) {
var cur = 0;
arr.next = function() {
if (++cur <= this.length - 1) {
return this[cur];
} else {
cur = 0;
return this[cur];
}
};
@juanlatorre
juanlatorre / namecheap SSL.md
Created June 15, 2019 14:14 — forked from Shourai/namecheap SSL.md
Letsencrypt SSL certificate with namecheap hosting

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.