Skip to content

Instantly share code, notes, and snippets.

View dance2die's full-sized avatar
🐰
Working

Sung M. Kim dance2die

🐰
Working
View GitHub Profile

Beginner's Thread / Easy Questions (November 2019)

[Previous threads][wiki previous threads] can be found in the Wiki.

Got questions about React or anything else in its ecosystem? Stuck making progress on your app?
Ask away! We’re a friendly bunch.

No question is too simple. 🙂


ls | % {
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_split?view=powershell-6
$parsed = $_.Name -split '(\d{4})-(\d{2})-(\d{2})-(.*)'
$year = $parsed[1];
$month = $parsed[2];
$day = $parsed[3];
$name = $parsed[4];
$newDir = "$year/$month/$day";
// Original code
const pingEpic = (
action$,
) => (
action$
.pipe(
ofType(PING),
delay(1000),
map(pong),
)
export const pingEpic = action$ =>
action$.pipe(
ofType(PING),
// 1️⃣ from "delay(1000)" to 👇
switchMap(() => timer(1000)),
mapTo(pong()),
tap(console.info)
);
// 2️⃣ pongEpic stays the same.
import { ofType } from "redux-observable";
import { mapTo, tap, delay } from "rxjs/operators";
export const PING = "PING";
export const PONG = "PONG";
export const ping = () => ({ type: PING });
export const pong = () => ({ type: PONG });
export const pingEpic = action$ =>
dance2die@dokku:~/node-js-getting-started$ git push dokku master
Enter passphrase for key '/home/dance2die/.ssh/id_rsa':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 291 bytes | 291.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
-----> Cleaning up...
-----> Building node-js-getting-started from herokuish...
-----> Adding BUILD_ENV to build environment...
# Install Open SSH server & client
sudo apt install openssh-server openssh-client
# Open port 22 to allow connection
sudo ufw allow 22
# Deploy the code to Dokku
git push dokku master
# 1️⃣ 2️⃣ 3️⃣ 4️⃣
git remote add dokku dokku@dokku:node-js-getting-started
dokku apps:create node-js-getting-started
# install docker
wget -nv -O - https://get.docker.com/ | sh
# setup dokku apt repository
-wget -nv -O - https://packagecloud.io/dokku/dokku/gpgkey | apt-key add -
+wget -nv -O - https://packagecloud.io/dokku/dokku/gpgkey | sudo apt-key add -
export SOURCE="https://packagecloud.io/dokku/dokku/ubuntu/"
export OS_ID="$(lsb_release -cs 2>/dev/null || echo "trusty")"
echo "utopicvividwilyxenialyakketyzestyartfulbionic" | grep -q "$OS_ID" || OS_ID="trusty"
-echo "deb $SOURCE $OS_ID main" | tee /etc/apt/sources.list.d/dokku.list