Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jgoux's full-sized avatar
I'm the fastest meme alive

Julien Goux jgoux

I'm the fastest meme alive
View GitHub Profile
@kshailen
kshailen / Connecting_postgress_RDS_from_local_via_bastion.md
Last active October 12, 2022 13:26
Ways to connect to postgress RDS instance from bastion host and from local host

When it comes to databases and AWS VPC, best practice is to place your database in private subnet. By definition, private subnet in AWS is not reachable from the Internet because no Internet gateway is attached to private subnet. This is the way you protect your data. This kind of configuration is good for security but bad for data management.

How can you easily access and manage your secured data?

basic_RDS_bastion_architecture

There are two basic ways to acees it.

  1. Access postgres RDS from bastion host. There are following requirements for this.
// NOTE: you will NOT write code like this when using suspense
// instead, you'll use react-cache (not yet officially published)
// it'll handle things like pre-loading, handling rapid re-renders, etc.
const cache = {}
function FetchPokemon({pokemonName}) {
const pokemon = cache[pokemonName]
if (!pokemon) {
const promise = fetchPokemon(pokemonName).then(
@jaredly
jaredly / App.re
Last active January 1, 2021 17:34
ReasonReact Context API Example
module StringContext =
Context.MakePair({
type t = string;
let defaultValue = "Awesome";
});
let component = ReasonReact.statelessComponent("Tree");
let make = _children => {
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@dwhitney
dwhitney / README.md
Last active March 5, 2022 12:54
Quick React Native with PureScript
  1. create-react-native-app purescript-app; cd purescript-app

  2. pulp init --force

  3. pulp build

  4. src/Main.js

var React = require("react");
var RN = require("react-native");

exports.text = function(props){
@jaredpalmer
jaredpalmer / EmailInput.jsx
Created November 29, 2017 18:06
Formik async email signup input
import React from 'react';
import debounce from 'utils/debounce';
class EmailInput extends React.Component {
checkEmail = value => {
// only check if the field passes Yup email validation first
if (
!this.props.form.errors[this.props.name].includes(
'invalid' /* or whatever your error message is*/
)
#!/usr/bin/env stack
{-
stack
--resolver lts-8.4
--install-ghc
runghc
--package aeson
--package aeson-casing
--package base
--package bytestring
compiler-check: match-exact
resolver: lts-7.10
compiler: ghc-8.0.1.20161117
setup-info:
ghc:
linux64:
8.0.1.20161117:
url: http://downloads.haskell.org/~ghc/8.0.2-rc1/ghc-8.0.1.20161117-x86_64-deb8-linux.tar.xz
content-length: 112047972
sha1: 6a6e4c9c53c71cc84b6966a9f61948542fd2f15a
@dmfay
dmfay / collapse.js
Last active September 6, 2017 17:56
Collapse JOIN query result sets into a hierarchical object graph
'use strict';
/**
* Collapses tabular result sets into a (hierarchical) object graph based on
* column nomenclature. Given a query that selects parent and child columns as
* parent__id, parent__val, children__id, children__val, this will return an
* array of objects in the form
*
* {id: 1, val: 'parent val', children: [{id: 11, val: 'child val'}]}
*

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x