Skip to content

Instantly share code, notes, and snippets.

View iegik's full-sized avatar
🏠
Working from home

Arturs Jansons iegik

🏠
Working from home
View GitHub Profile
@iegik
iegik / LXC.md
Last active February 11, 2021 09:18
@iegik
iegik / REACT.md
Last active January 29, 2021 17:41

Presentational and Container Components

Dumb (stateless) and Smart components

Dumb:

import React from 'react';
export default (props = {}) => (
    <View/>
)
## Node.js
node () { docker run -it -u $(id -u) -v "$PWD":/usr/src/app -w /usr/src/app --rm node:4 node $@; }
npm () { docker run -it -u $(id -u) -v "$PWD":/usr/src/app -v $HOME/.npm:/.npm -w /usr/src/app --rm node:4 npm $@; }

Before rafactoring, clean the code base

  1. Use Git
  2. Choose your style guide and use linters
  3. Create graph and clean dead code
  4. Determinate code duplication, use patterns

Git

Using git saves time to find a bug, by code author or feature

@iegik
iegik / ionic.md
Last active January 27, 2021 07:43

Ionic/Capacitor

Add ionic to existing app

ionic init

choose your js fasmework

@iegik
iegik / CORDOVA.md
Last active September 13, 2022 10:25

Setup

npm install -g cordova
cordova config set -g telemetry false
cordova create my-app && cd my-app
JAVA_HOME=`/usr/libexec/java_home -v 1.8` cordova requirements android
cordova platform add android
cordova build android
@iegik
iegik / bash-search.sh
Created February 12, 2020 14:35
Bash search script
#!/bin/bash
# grep -sinE $1 --color -R ./* > $2; wc -l $2;
TEXT=$1
FILE=$2
grep -sinE $TEXT -R ./* | awk -F":" '{ print "name: "$1"\nline: "$2"\ncontent "$3"\ninfo: \""; system("stat -nf\"%z, %B %m\" "$1); print "\"\n"}' > $FILE;
grep "name: " $FILE | wc -l;
@iegik
iegik / README.md
Last active January 27, 2021 07:32

If you accidently remove any host from known_hosts you can restore them by following command:

ssh-keyscan -H HOSTNAME >> ~/.ssh/known_hosts
@iegik
iegik / README.md
Last active January 14, 2019 10:04

LOGICAL AND - a ∧ b (a && b) - is true if A and B are both true; else it is false.

LOGICAL OR - a ∨ b (a || b) - is true if A or B (or both) are true; if both are false, the statement is false.

LOGICAL XOR - a ⊕ b (a != b) - is true when either A or B, but not both, are true.

EQUIVALENCE - a ↔ b (a == b) - means A is true if B is true and A is false if B is false

LOGICAL NOT - ¬a (!a) - is true if and only if A is false.

@iegik
iegik / README.md
Last active January 27, 2021 08:12
Video in Markdown

in markdown format:

HTML image:

HTML video: