Skip to content

Instantly share code, notes, and snippets.

@norbajunior
norbajunior / Flexible Dockerized Phoenix Deployments.md
Created November 16, 2022 00:57 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@norbajunior
norbajunior / markdown-details-collapsible.md
Created June 27, 2020 14:03 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@norbajunior
norbajunior / unfold.rb
Created February 25, 2018 06:19 — forked from havenwood/unfold.rb
Imitating Elixir's Stream.unfold/2 in Ruby
class Enumerator
def self.unfold tuple
new do |yielder|
loop do
current, tuple = yield tuple
yielder << current
end
end
end
end
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(props.offset) } // now we receive the initial offset calculated
} // coming from the parent component
componentDidMount() {
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(-100) } // We initially set an Animated.Value with -100
}
componentDidMount() { // When the component is mounted the animation runs.
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(props.offset) } // agora recebemos o offset inicial calculado
} // do componente pai
componentDidMount() {
class Notification extends Component {
render() {
<View style={{ transform: [{ translateY: -100 }] }>
<Image source={this.props.avatar} />
<Text>Nova Mensagem</Text>
<Text>{this.props.message}</Text>
</View>
}
}
import { Animated } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.offset = new Animated.Value(props.offset)
}
componentDidMount() {
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(-100) } // iniciamos aqui um Animated.Value com valor -100
}
componentDidMount() { // Quando o componete estiver montado executamos a animação.
import React, { Component } from 'react'
import { View, Button } from 'react-native'
const newNotifications = [
{
id: 1,
message: "I'm here to bother you. Don't ignore me!",
avatar: require('./images/3cpo.jpg')
},
{