Skip to content

Instantly share code, notes, and snippets.

View jsturg's full-sized avatar

Josh Sturgeon jsturg

View GitHub Profile
@jsturg
jsturg / Elixirdesignpatterns.md
Created December 7, 2016 17:40 — forked from itsderek23/Elixirdesignpatterns.md
Elixir foundations for Ruby Devs: transforming data

Elixir foundations for Ruby Devs: transforming data

Have you ever reached for a drink of water, then realized, half-way through your first sip, it was Sprite? I like Sprite, but that first sip of a similar-looking, but very different liquid is a shock.

That's how Elixir can feel if you're coming from Ruby. The syntax looks similar, but Elixir is different from the first sip. For a smooth transition, you need to (a) learn some functional programming patterns and (b) unlearn some Object-Orientated habits.

A core design pattern of Elixir is the focus on data transformations: you'll see it in libraries like Ecto.Changeset, Ecto.Multi, Plug.Conn and built-ins like Enum. Let's dive in.

Data Transformations

@jsturg
jsturg / emailmarketing.md
Last active January 12, 2017 20:14
How to (not) grow with Email Marketing

Email marketing has proven to be a successful tool for reaching leads and growing sales. The web is full of tools and resources to help you create and manage money making email campaigns. You can grow sales and increase your brand perception by learning from this mistake we made with email marketing.

money

Our plan to grow

A few months after we launched we began implementing several popular marketing strategies. We setup our Hubspot and Mailchimp marketing campaigns, tested and tuned dozens of emails and prepared to launch a massive cold email campaign to our deep list of leads. I could nearly smell the money rolling in from all the leads we were sure to convert. It was game time!



Finally, the moment our team had prepared for! We hit “send” on our first of many finely crafted, highly focused, mother approved - email marketing campaigns. Now we just had to wait

@jsturg
jsturg / pure-impure.md
Last active January 18, 2017 21:53 — forked from tomekowal/pure-impure.md
Pure vs impure

Pure vs impure and why should I care?

Some of the most important advancements in programming came from adding restrictions to the way we program. Famous article by Edsger Dijkstra Go To Statement Considered Harmful shows how introducing one statement into programming language breaks many key properties of that language. Using goto gives us freedom and solves a couple of simple problems like breaking from nested loops easily, but it can make programs very hard to understand.

This happens, because we cannot look at two pieces of code in separation. The execution can jump to some other place in code or even worse: it can jump from another piece of code to here and we need to keep that in mind.