Responsive target

### Responsive target devices

```
@media (min-width:320px)  { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:481px)  { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:641px)  { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:961px)  { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
```

Footer at bottom

### Footer bottom

I've developed quite an easy method to stick the Footer at the bottom, but as most common methods, you will need to tweak it to fit your Footer's height.

This method below uses a "trick" by placing an ::after pseudo-element on the body, and set it to have the exact height of the footer, so it will occupy the exact same space the footer does, so when the footer is absolute positioned over it, it would appear like the footer is really taking up space and eliminate the negative affects of it's absolute positioning (for example, going over the body's content)
```
HTML (basic common markup)
html{ height:100%; }
body{ min-height:100%; padding:0; margin:0; position:relative; }
header{ height:50px; background:lightcyan; }
footer{ background:PapayaWhip; }

/* Trick: */
body {
  position: relative;
}

body::after {
  content: '';
  display: block;
  height: 50px; /* Set same as footer's height */
}

footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50px;
}

golang - sliceの重複を削除

// sliceの重複要素を削除
func slimSlice(slice []int) []int {
	m := make(map[int]int)
	slim := make([]int, 0)
	for _, element := range slice {
		if _, ok := m[element]; !ok {
			m[element] = 0
			slim = append(slim, element)
		}
	}
	return slim
}

golang - gcd 最大公約数

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

CSS GRID ESSENTIALS

CSS GRID ESSENTIALS
Review
At this point, we've covered a great deal of different ways to manipulate the grid and the items inside it to create interesting layouts.

grid-template-columns defines the number and sizes of the columns of the grid
grid-template-rows defines the number and sizes of the rows of the grid
grid-template is a shorthand for defining both grid-template-columns and grid-template-rows in one line
grid-gap puts blank space between rows and/or columns of the grid
grid-row-start and grid-row-end makes elements span certain rows of the grid
grid-column-start and grid-column-end makes elements span certain columns of the grid
grid-area is a shorthand for grid-row-start, grid-column-start, grid-row-end, and grid-column-end, all in one line
You have seen how to set up and fill in a grid and you now have one more CSS positioning technique to add to your toolkit!

Gravity Perks // Limit Dates // Disable All Dates & Set Enabled Dates via Exceptions

<?php
/**
 * Gravity Perks // Limit Dates // Disable All Dates & Set Enabled Dates via Exceptions
 * http://gravitywiz.com/documentation/gravity-forms-limit-dates/
 */
add_filter( 'gpld_limit_dates_options_123_1', function( $options, $form, $field ) {

	$options['exceptionMode'] = 'enable';
	$options['disableAll'] = true;

	return $options;
}, 10, 3 );

macos-info.md

# Helpful Information for MacOS
The below information is current as of 2019-02-01 and applies to MacOS 10.14.x (Mojave).  

This document is meant to serve as an aid and reference in preparing a MacOS system, the process and .dotfiles are completed manually. Note that the default Terminal is replaced with iTerm2 and Bash v5.  

For additional information or help please feel free to ping via https://www.coreygo.com.

#### System information commands
- `uptime` displays current system uptime
- `system_profiler SPHardwareDataType` displays hardware overview
- `system_profiler -listDataTypes` lists available system_profiler options
- `system_profiler -detailLevel basic > ~/system_profile.txt` outputs to text document for sharing

# Security
Review the [macOS Security and Privacy Guide](https://github.com/drduh/macOS-Security-and-Privacy-Guide).

#### Set root password
- `sudo passwd -u root`
* For Development
- `sudo spctl --master-disable`

# Software updates
- `softwareupdate -l`
- `sudo

React Native Handy

import call from 'react-native-phone-call';

const args = {
  number: this.state.contactDirectly, // String value with the number to call
  prompt: true // Optional boolean property. Determines if the user should be prompt prior to the call 
}
 
call(args).catch(()=>null)

macOS Mojave (Dev)

macOS Mojave (Dev)
# Install Guide

> **macOS Mojave 10.14 - kevyworks**

Preparing Environment
--

**1. Install Homebrew**
```sh
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
$ source ~/.bash_profile
```

**2. Install Essentials**
```sh
$ brew install git
$ brew install wget
$ brew cask install google-chrome
$ brew cask install firefox
$ brew cask install visual-studio-code
```

**3. Install Node Version Manager**
```sh
$ mkdir ~/.nvm
$ echo $'\n# NodeJS' >> ~/.bash_profile
$ echo "export NVM_DIR=~/.nvm" >> ~/.bash_profile
$ echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.bash_profile
$ source ~/.bash_profile
$ brew install nvm
$ nvm install --lts && node -v
```

**4. Install PHP, Composer & Valet+**
```sh
$ brew install php@7.1
$ echo $'\n# PHP' >> ~./bash_profile
$ echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/php@7.1/sbin

Gen random hex color

 function getRandomColor() {
  let string = ''
  const { min, max } = {
    min: 0,
    max: 255
  }
  const getRandom = () => (Math.floor(min + Math.random() * (max + 1 - min)))
  
  for(let i = 0; i < 3; i++) {
	  let rnd = getRandom(),
        hex = rnd.toString(16)
        
	  if(hex.length < 2) hex = '0' + hex
	  string += hex
  }

  return '#' + string
}

Redux selector


reducer.js
```js
import rpr from "../../_redux/reducerPathResolver";
//...
export const modalVisibilitySelector = (state: any) => state[rpr[reducerResolverKey]].show
export const reducerResolverKey = 'modal'
```

reducerPathResolver.js
```js
import { reducerResolverKey as modal } from "../_utils/Modal/reducer";
export default {
  [modal]: 'modal'
}
```

rootReducer.js
```js
import modalReducer, { reducerResolverKey as modal } from '../_utils/Modal/reducer';

export const rootReducer = combineReducers({
  [rpr[modal]]: modalReducer,
})

export const getSelectedPerson = (state: any) => state.selectedPerson
```

use Reducer path resolve solution to make better selectors

- [ ] make sure there is no repetition key in `reducerPathResolver`, set up a function to validate it

Golang editorconfig template

Golang Editorconfig template #golang #editorconfig
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://EditorConfig.org

root = true

###########################################################
; common
###########################################################

[*]
charset = utf-8

end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true

indent_style = space
indent_size = 4

###########################################################
; make
###########################################################

[Makefile]
indent_style = tab

[makefile]
indent_style = tab

###########################################################
; markdown
###########################################################

[*.md]
trim_trailing_whitespace = false

###########################################################
; golang
###########################################################

[*.go]
indent_style = tab
indent_size = 4

Golang Makefile

PROJECT_NAME := "gitlab-mr-commenter"
PKG := "gitlab.com/brpaz/$(PROJECT_NAME)"
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)

.PHONY: all dep build clean test lint

all: build

lint: ## Lint the files
  @golint -set_exit_status ${PKG_LIST}

test: ## Run unittests
  @go test -short ${PKG_LIST}

race: dep ## Run data race detector
  @go test -race -short ${PKG_LIST}

msan: dep ## Run memory sanitizer
  @go test -msan -short ${PKG_LIST}

dep: ## Get the dependencies
  @go mod tidy

build: dep ## Build the binary file
  @go build -i -v $(PKG)

clean: ## Remove previous build
  @rm -f $(PROJECT_NAME)

help: ## Display this help screen
  @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

How you compile a program from a source

# Extract files with one of commands
tar -xvzf PACKAGENAME.tar.gz
tar -xvjf PACKAGENAME.tar.bz2

./configure
make
sudo make install

Analyse Function Steps

import dis

dis.dis(greet)

def greet(test):
    pass

Recursively change acces permission on folder

sudo chmod -R a+rwx [folder]