Skip to content

Instantly share code, notes, and snippets.

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

Evaldo Santos evaldosantos

🏠
Working from home
View GitHub Profile
ng g store AppState --root --module app.module.ts
interface Action {
type: string;
payload?: any;
}
interface Reducer<T> {
(state: T, action: Action): T
}
interface ListenerCallback {
RxJS
RxJS is a library for composing asychronous and event-based programs by using observable sequences.
It combines the Observer pattern with the Iterator pattern and functional programming with collections.
Essential conecpts:
- Observable: (event stream)
represents the idea of an invokable collection of furure values or events.
- Observer (callback)
is a collection of callbacks that knows how to listen to values delivered by the Observable
- Subscription (execution)
represents the execution of an Observable, is primarily useful for cancelling the execution
# run composer from command line using docker
docker run --rm -it -v $PWD:/app -v $SSH_AUTH_SOCK:/ssh-auth.sock -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -u $(id -u):$(id -g) -e SSH_AUTH_SOCK=/ssh-auth.sock composer install
# run php from command line using docker
docker run -it --rm -p 8000:8000 -v $(pwd):/app -w /app php:cli php artisan serve --host=0.0.0.0
# docker-composer.yml
const spy = jest.spyOn(MODULE, 'myFunction').mockImplementation(() => Promise.resolve({payload: 2}));
spy.mockRestore()
# enable vivaldi codecs
# 1. install chromium codecs extra
sudo dnf install chromium-libs-media-freeworld.x86_64 -
# 2. move old vivaldi libffmpeg
sudo mv /opt/vivaldi/lib/libffmpeg.so /opt/vivaldi/lib/libffmpeg.so.backup
# 3. link vivaldi ffmpeg to chromium ffmpeg
sudo ln -s /usr/lib64/chromium-browser/libffmpeg.so /opt/vivaldi/lib/libffmpeg.so
export default function createAsyncAction (type, fn) {
return (...args) => async (dispatch) => {
dispatch({
type: `${type}_STARTED`,
payload: args
});
let result;
try {
result = await fn(...args);
} catch (error) {
import { increaseCount, reducer, store } from './counter';
describe('Counter', () => {
it('should have a default state', () => {
const result = reducer();
expect(result.count).toEqual(0);
});
it('should increase the count', () => {
const action = increaseCount();
sudo dnf clean all
sudo dnf -y install gstreamer-plugins-base gstreamer1-plugins-base gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer1-plugins-ugly gstreamer-plugins-good-extras gstreamer1-plugins-good-extras gstreamer1-plugins-bad-freeworld ffmpeg gstreamer-ffmpeg
sudo dnf install rhythmbox -y
sudo dnf config-manager --add-repo=http://negativo17.org/repos/fedora-spotify.repo
sudo dnf install spotify -y
sudo dnf clean all
# Install the dnf-plugins-core package which provides the commands to manage your DNF repositories from the command line.
sudo dnf -y install dnf-plugins-core
# Use the following command to set up the stable repository.
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
# Enable the edge and test repositories.
sudo dnf config-manager --set-enabled docker-ce-edge