Skip to content

Commit

Permalink
Added pages with new folder names
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerardo Maldonado committed Aug 14, 2019
1 parent 4ca2745 commit 66327a2
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/pages/20190810-git-revert-what/index.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Git Revert Que?
date: '2019-08-10'
spoiler: Lo unico que tenemos que decidir es que hacer con el tiempo que se nos ha dado.
---

Si te gusta leer sobre tecnología y cambio climático, estás en el lugar correcto! Me apasiona mucho todo lo que rodea esos temas, haré lo mejor que pueda para desarrollar contenido y escribir sobre cosas que potencialmente puedan ser útiles o interesantes para ti.

**> git revert EARTH** es un juego de palabras sobre un comando de git [git command](https://git-scm.com/docs/git-revert)
```
git revert HEAD~3
```
De la documentación oficial de git:

Dados uno o mas commits existentes, revierte los cambios que los parches relacionados introducen, y registra algunos nuevos commits que lo documentan. Esto requiere que tu árbol de trabajo esté limpio (sin modificacions del commit de `HEAD`)

Nota: git revert es usado para registrar algunos nuevos commits que revierten el efecto de algunos commits más antiguos (en muchas ocasiones, únicamente uno que no se quiere). Si quieres desaserte de todos los cambios que no se enuentran en un commit en tu directorio de trabajo, deberías ver `git reset`[1], particularmente la opción `--severo`. Si solo quieres extraer archivos específicos como si estos estuvieran en otro commit, deberías consultar `git checkout`[1], específicamente la sintáxis `git checkout <commit> -- <filename>`. Ten cuidado con estas alternativas ya que ambas deshecharán cambios que no pertenecen a un commit en tu directorio de trabajo.


For the purpose of this blog, I would love to translate that previous description like this:

_Given one or more existing **human induced climate alterations**, revert the changes that the related **decisions** introduce, and record **the actions** that **aliviate** them. This **also requires consistent individual and collective clean action** (no **reset and forget**)._

_Note: git revert **EARTH** is used to record some new **actions** to reverse the effect of some earlier **decisions** (often only a faulty one). If you want to throw away all **your will to change** in your (still) working **planet**, you should see `git i-don't-care`[1], particularly the `--hard` option. If you want to **perform only** specific **and easy actions** as they were in another **parts of your life**, you should see `git only-the-easy-things`[1], specifically the `git only-the-easy-things <no-straws> -- <plastic>` syntax. Take care with these alternatives as both will discard **collective action and desperately needed change** in your (still) working **planet**._

![Street protest with a sign displaying: Time is running out](./mika-baumeister-HR8IqMQNT8M-unsplash.jpg "Photo by Mika Baumeister on Unsplash")
25 changes: 25 additions & 0 deletions src/pages/20190810-git-revert-what/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Git Revert What?
date: '2019-08-10'
spoiler: All we have to decide is what to do with the time that is given us.
---

If you enjoy reading about technology and climate change, you are in the right place! I am very passionate about everything that surrounds those topics and I will try my best to develop content and write about things that can potentially be useful or interesting to you.

**> git revert EARTH** is a play of words on an actual [git command](https://git-scm.com/docs/git-revert)
```
git revert HEAD~3
```
From the official git documentation:

>Given one or more existing commits, revert the changes that the related patches introduce, and record some new commits that record them. This requires your working tree to be clean (no modifications from the `HEAD` commit).
>
>Note: git revert is used to record some new commits to reverse the effect of some earlier commits (often only a faulty one). If you want to throw away all uncommitted changes in your working directory, you should see `git reset`[1], particularly the `--hard` option. If you want to extract specific files as they were in another commit, you should see `git checkout`[1], specifically the `git checkout <commit> -- <filename>` syntax. Take care with these alternatives as both will discard uncommitted changes in your working directory.
For the purpose of this blog, I would love to translate that previous reference like this:

_Given one or more existing **human induced climate alterations**, revert the changes that the related **decisions** introduce, and record **the actions** that **aliviate** them. This **also requires consistent individual and collective clean action** (no **reset and forget**)._

_Note: git revert **EARTH** is used to record some new **actions** to reverse the effect of some earlier **decisions** (often only a faulty one). If you want to throw away all **your will to change** in your (still) working **planet**, you should see `git i-don't-care`[1], particularly the `--hard` option. If you want to **perform only** specific **and easy actions** as they were in another **parts of your life**, you should see `git only-the-easy-things`[1], specifically the `git only-the-easy-things <no-straws> -- <plastic>` syntax. Take care with these alternatives as both will discard **collective action and desperately needed change** in your (still) working **planet**._

![Street protest with a sign displaying: Time is running out](./mika-baumeister-HR8IqMQNT8M-unsplash.jpg "Photo by Mika Baumeister on Unsplash")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions src/pages/20190811-integrating-gatsby-mailchip/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: Integrating Mailchimp and Gatsby
date: '2019-08-11'
spoiler: A couple of things to be aware of when you integrate.
---

![Laptop opened with mail enevelopes around it](./campaign-creators-VV0En9viu2M-unsplash.jpg "Photo by Campaign Creators on Unsplash")

Since I based the implementation of this Gastby site out of [Dan Abramov's Overreacted](https://github.com/gaearon/overreacted.io), I had to make a few changes. One of them was the subscribe feature that Dan uses on his site with [Convert Kit](http://convertkit.com). I was not able to find a free tier to start up with them and I wanted to keep things simple so after a bit of research, I found that [Mailchimp](http://mailchimp.com) is a pretty solid option. They have a free plan for up to 2,000 subscribers for a single group audience which is more than enough for a starting blog site.

![Screenshot of Mailchimp options from their website](./mail-chimp-plans.png "Malchimp Plans")

### Setting up your Mailchimp Account
This process is very simple and you only need to head over [Mailchimp's free tier registration page](https://login.mailchimp.com/signup/?plan=free_monthly_plan_v0) to create your account so you get access to configure it.

### Gatsby Mailchimp Plugin
Fortunately, the contributed Gatsby plugin [gatsby-plugin-mailchimp](https://www.gatsbyjs.org/packages/gatsby-plugin-mailchimp/) facilitates the process of this integration. This plugin is fantastic, You can pretty much follow the instructions on the documentation page and it will get you almost there!

However, the documentation is a bit dated (Mailchimp has changed its layout) so it can get a bit confusing when you are reading through.

The things you should consider when you read the documentation are:
- **Mailchimp Endpoint**
1. Login to your Mailchimp account
2. Click **Audience** tab at the top
3. From the dropdown on the right select: "Signup forms"
4. Click “Embedded forms”
5. Continue with the remaining instructions from the documentation
- **Gatsby Import Plugin Instructions**
For this section, you can take a look at the example there but I found the example inside the plugin way more useful, you can find it on the [gatsby-plugin-mailchimp Github repository](https://github.com/benjaminhoffman/gatsby-plugin-mailchimp/blob/master/examples/gatsby-v2/src/pages/index.js)


### Troubleshooting
If for some reason you are getting an error on your JavaScript console like these:
```
SyntaxError: expected expression, got '<'
```
```
was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type
```
Or if you are getting Mailchimp's **404 Page not Found** errors when you perform the request. It might be because the URL you copied from the Mailchimp embeddable form is wrong. I did not realize this after I looked at it with a microscope! The issue for me was that the URL I copied from the form action element contained HTML encoded characters, in my case, it was something like this:

`https://gmail.us3.list-manage.com/subscribe/post?u=xxxxxxxxxxxxxxxxxxxxxx&amp;id=xxxxxxxxxxxxx`

see that `amp;` over there? the correct URL should be something like this:

`https://gmail.us3.list-manage.com/subscribe/post?u=xxxxxxxxxxxxxxxxxxxxxx&id=xxxxxxxxxxxxx`

That was one of my biggest issues when I was debugging these errors, Just make sure that you don't have encoded characters in your URL string and that your user and id strings are also correct.

Another interesting thing I learned when I was experimenting with this on POSTMAN and taking a look at the plugin code is that the last part of the URL needs to be `post-json` instead of `post`. If you are using this plugin you should not worry about it or change that in your gatsby-config.js configuration file, the plugin takes care of that automatically and converts that part of the URL string for us!

Lastly, I was running into an issue where I was not being able to correctly map the name of my subscribers when they were filling the Subscribe form. None of the examples tell you very clearly how to send extra fields to Mailchimp and if you are struggling like I was, I can show you how I was able to do it.

If you did not change any of the field mappings on your Mailchimp Embeddable Form configuration you will notice that they already have some defaults:
You can get there by clicking on:

**Audience -> (Manage Audience dropdown) -> Signup Forms -> Embedded Forms -> Settings -> Audience Fields and *|MERGE|* tags**

Once there, you will see the names that Mailchimp is expecting you to send, for example the default tag for name is FNAME, if you want Mailchimp to store these fields (or others you might need) you need to send a JSON object with these keys and values as the second argument of the `addToMailchimp` function, for instance:

```JSX
addToMailchimp(this.state.email, {'FNAME': this.state.name})
```

You don't have to worry about wrapping email in a JSON object because the plugin will take care of sending that correctly (You cannot change that tag on Malchimp's configuration).

Please let me know if any of this information was helpful to you, see you in the next post!

g.



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 66327a2

Please sign in to comment.