Skip to content

Instantly share code, notes, and snippets.

View gastonambrogi's full-sized avatar
🌱
Growing

Gastón Ambrogi gastonambrogi

🌱
Growing
  • Freelancer Frontend Developer
  • Buenos Aires, Argentina
  • 23:44 (UTC -03:00)
  • X @gastonambrogi
View GitHub Profile
@gastonambrogi
gastonambrogi / gist:21ac51ba23628d045374ba7006dd7482
Created July 18, 2022 17:43
REACT:: add custom errors to state
const addCustomValidationError = (
form: Partial<UseFormReturn>,
formKey: string,
message: string
) => {
setCustomValidationErrors((previousState: CustomValidationError[]) => {
const foundForm = previousState.findIndex(
(customerrors) => customerrors.form === form
);
@gastonambrogi
gastonambrogi / canvas2form.js
Last active January 7, 2021 19:58
attach canvas data to form
const canvas = document.getElementById('my-canvas');
canvas.toBlob(function(blob) {
const formData = new FormData();
formData.append('my-file', blob, 'filename.png');
// Post via axios or other transport method
axios.post('/api/upload', formData);
});
@gastonambrogi
gastonambrogi / find_replace.vim
Created September 26, 2019 16:07
[VIM] Replace all ocurrences in lines that starts with 'pick' from the line 2 to the end of the file with 'squash' (ideal for git rebasing)
:2,$s/^pick/squash/g
@gastonambrogi
gastonambrogi / gitflow-breakdown.md
Created September 23, 2019 18:43 — forked from morrismatts/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@gastonambrogi
gastonambrogi / index.html
Created August 13, 2019 20:11 — forked from joshuakemmerling/index.html
Pure CSS horizontal scrolling shadows
<!DOCTYPE html>
<html>
<head>
<style>
.scrollbox {
overflow: auto;
width: 200px;
max-height: 200px;
margin: 50px auto;
@gastonambrogi
gastonambrogi / corner-gradients.css
Created July 29, 2019 02:25
Set corners gradients on an element
ackground: radial-gradient(180px at top right,#685e31,rgba(0,0,0,0)),radial-gradient(180px at top left,#0d92c3,rgba(0,0,0,0)),radial-gradient(180px at bottom left,#8a43bd,rgba(0,0,0,0)),radial-gradient(180px at bottom right,#1d8d42,rgba(0,0,0,0));
@gastonambrogi
gastonambrogi / seeded_random.js
Created July 11, 2019 17:26
Function that generates a random by a seed
function random(seed) {
var x = Math.sin(seed) * 10000;
return x - Math.floor(x);
}
@gastonambrogi
gastonambrogi / .gitignore
Last active June 29, 2019 22:40
Estructura basica de directorios para maquetar usando Sass + Gulp
dist/
@gastonambrogi
gastonambrogi / heart-animation.css
Created May 16, 2019 04:13
CSS animation of a heart
@-webkit-keyframes animateHeart {
0% {
-webkit-transform: scale(1);
transform: scale(1)
}
15% {
-webkit-transform: scale(1.15);
transform: scale(1.15)
}
30% {
@gastonambrogi
gastonambrogi / MySQL_macOS_Sierra.md
Created April 6, 2019 18:40 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :