Skip to content

Instantly share code, notes, and snippets.

View zivanovicb's full-sized avatar
👋

Branko Zivanovic zivanovicb

👋
View GitHub Profile
@zivanovicb
zivanovicb / .js
Created February 3, 2020 11:03
ConnectedComponent
const mapStateToProps = (state, { data }) => {
return {
data: IpqsSelectors.selectLastEntry(state),
isRequestingOne: !!RequestSelectors.selectInProgress(state, [IpqsAction.GET_ONE.REQUEST])
}
}
const mapDispatchToProps = (dispatch) => ({
requestOne: async (email) => dispatch(IpqsAction.requestOne(email))
})
@zivanovicb
zivanovicb / postgres-cheatsheet.md
Created December 1, 2019 00:06 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@zivanovicb
zivanovicb / postgres-brew.md
Created November 30, 2019 23:44 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@zivanovicb
zivanovicb / gist:56e7a5c83bfc31f2973cdf2c897c1cbf
Created July 20, 2019 12:58
start postgres on arch/manjaro
sudo chown -R postgres:postgres /var/lib/postgres/
sudo mkdir /run/postgresql
sudo chown postgres:postgres /run/postgresql
sudo -iu postgres
pg_ctl -D /var/lib/postgres/data -l logfile start
@zivanovicb
zivanovicb / nginx.conf
Created February 8, 2019 13:38
nginx to serve react app
# auto detects a good number of processes to run
worker_processes auto;
#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
# Tells the worker to accept multiple connections at a time
multi_accept on;
}
/bin/sh -c "trap : TERM INT; (while true; do sleep 1000; done) & wait"
FROM node:6.9.2
VOLUME ./ /home/video/uploader
WORKDIR /home/video/uploader
RUN yarn install
CMD yarn start
var React = window.React;
var ReactDOM = window.ReactDOM;
window.onload = function () {
// opcije:
// 1: "stil-kurir"
// 2: "kurir"
// 3: "espreso"
// 4: "glossy-espreso"
ReactDOM.render(
React.createElement(window.App, { publisher: "kurir" }),
import styled from "styled-components";
const ButtonWithIcon = styled.button`
background-image: url(${props => props.url});
background-size: 14px 14px;
background-position: 10px center;
background-repeat: no-repeat;
background-color: ${props => props.bg || "#47B4FE"};
padding: ${props => props.pTB || "10px"} 16px;
padding-left: 32px;
@zivanovicb
zivanovicb / .js
Created July 9, 2017 11:01
React Icon component example
import React from 'react';
import styled from 'styled-components';
const Wrapper = styled.a`
margin-right:20px;
:hover{
path{
fill:${props => props.hoverFill || props.theme.navy};
}
}