Skip to content

Instantly share code, notes, and snippets.

View santiagopoli's full-sized avatar

Santiago Ignacio Poli santiagopoli

View GitHub Profile
@santiagopoli
santiagopoli / listings.json
Last active September 27, 2016 02:39
Listings
[
{
"id": 8778879,
"name": "Majestic SC Panoramic w/Queen bed",
"typeText": "Entire home",
"instantBook": true,
"price": 79,
"starRating": 5,
"reviewsCount": 40,
"previewImageURL": "https://a0.muscache.com/im/pictures/a5d62823-d3bc-4f58-b946-f4898a3c519d.jpg?aki_policy=x_medium",
const FavoritesView = ({ favorites, onSelectFavorite }) =>
<View>
<FavoritesList favorites={favorites} onSelectFavorite={onSelectFavorite}/>
</View>
const FavoritesScreen = ({ navigation }) =>
<FavoritesView onSelectFavorite={favorite => navigation.push('FAVORITE', {{ favorite: favorite }})}/>
const NavigationStack = StackNavigator({
FAVORITES: FavoritesScreen,
const clear = (favoriteId) => state => ...
const fetching = (favoriteId) => state => ...
const finishFetching = (favoriteId, favorite) => state => ...
export default (state = {}, action) => {
switch (action.type) {
case 'CLEAR_FAVORITE':
return clear(action.favoriteId)(state);
case 'FETCHING_FAVORITE':
return fetching(action.favoriteId)(state);
const mapDispatchToProps = (dispatch, props) => ({
onSelectFavorite: (favorite) => {
props.onSelectFavorite(favorite);
dispatch(fetchFavoriteInfo(favorite.id));
}
})
const mapStateToProps = (state) => ({
favorites: state.favorites
})
const platformSpecific = ({ios, android}) => (Platform.OS == ‘ios’) ? ios : android
<View style={{ color: platformSpecific({ ios: 'black', android: 'white' }) }}/>
@santiagopoli
santiagopoli / vpc.tf
Last active March 18, 2018 21:40
Terraform Blue Green / VPC
variable "vpc_id" {
default = "yourvpcid"
}
@santiagopoli
santiagopoli / bootstrap.tf
Last active March 18, 2018 21:55
Terraform Blue Green / Bootstrap
variable "infrastructure_version" {
default = "1"
}
provider "aws" {
region = "us-west-2"
}
terraform {
backend "s3" {
@santiagopoli
santiagopoli / keypairs.tf
Last active March 18, 2018 22:43
Terraform Blue Green / KeyPair
resource "aws_key_pair" "terraform-blue-green" {
key_name = "terraform-blue-green-v${var.infrastructure_version}"
public_key = "${file("keypairs/keypair.pub")}"
}
@santiagopoli
santiagopoli / dns.tf
Created March 19, 2018 15:18
Terraform Blue Green / (Optional) DNS
data "aws_route53_zone" "terraform-blue-green" {
name = "yourdomain.com."
}
resource "aws_route53_record" "terraform-blue-green" {
zone_id = "${data.aws_route53_zone.terraform-blue-green.zone_id}"
name = "v${var.infrastructure_version}.yourdomain.com"
type = "A"
alias {
@santiagopoli
santiagopoli / security_groups.tf
Last active March 19, 2018 15:36
Terraform Blue Green / Security Groups
resource "aws_security_group" "terraform-blue-green" {
description = "Terraform Blue/Green"
vpc_id = "${var.vpc_id}"
name = "terraform-blue-green-v${var.infrastructure_version}"
tags {
Name = "Terraform Blue/Green (v${var.infrastructure_version})"
}
}