Skip to content

Instantly share code, notes, and snippets.

View wojtek1150's full-sized avatar
🏕️

Wojciech wojtek1150

🏕️
View GitHub Profile
@wojtek1150
wojtek1150 / tag-npm-project-script.yml
Created April 6, 2023 08:30
YML script for create tag for NPM based project
# YML script for creating tag of npm project from release branch
# There are 2 wersions, x.y.z-SNAPSHOT for development and x.y.z for releasing.
# Tag will be created without snapshot postfix
before_script:
# fetch version to release from package.json snapshot version
- export RELEASE_VERSION=$(node -p "require('./package.json').version.replace('-SNAPSHOT','')")
# bump next patch version in pattern X.X.X+1 from RELEASE_VERSION
- export NEXT_PATCH_VERSION=$(perl -pe 's/^(\d+)\.(\d+)\.(\d+)$/"$1.$2.".($3+1)/e' <<< $RELEASE_VERSION)
@wojtek1150
wojtek1150 / cut-off-npm-project-script.yml
Last active April 6, 2023 08:30
YML script for cut-off NPM based project to release branch
# YML script for cuffing of npm project to release branch
# There are 2 wersions, x.y.z-SNAPSHOT for development and x.y.z for releasing.
# Release branch will be created without snapshot postfix
before_script:
# fetch version to release from package.json snapshot version
- export RELEASE_VERSION=$(node -p "require('./package.json').version.replace('-SNAPSHOT','')")
# bump next version in pattern X.X+1.0 from RELEASE_VERSION
- export NEXT_VERSION=$(perl -pe 's/^(\d+)\.(\d+)\.(\d+)$/"$1.".($2+1).".0"/e' <<< $RELEASE_VERSION)
@wojtek1150
wojtek1150 / bulk-delete-slack.js
Last active March 13, 2024 13:26
Delete all slack messages
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://app.slack.com/client/COMPANY_ID/CHANNEL_ID
// User id in on the browser URL.: https://app.slack.com/client/COMPANY_ID/CHANNEL_ID/user_profile/USER_ID
// Token can get from: https://api.slack.com/custom-integrations/legacy-tokens
// Pass it as a parameter: node ./bulk-delete-slack.js TOKEN CHANNEL_ID USER_ID DELAY
// Or use it without download the script: curl -Ls RAW_GIST_URL | node - TOKEN CHANNEL_ID
// GLOBALS #############################################################################################################
@Effect()
authenticateUser$ = this.actions$
.pipe(
ofType(authActions.AUTHENTICATE_USER),
switchMap(() => {
return this.angularFireAuth.authState.pipe(
map((identity: fromFirebase.User) => {
return identity
? new authActions.AuthenticateUserSuccess(ConvertingHelper.extractFirebaseUserInfo(identity))
: new authActions.AuthenticateUserFail('User Not logged In.');
constructor(
private angularFireAuth: AngularFireAuth
) { }
login() {
const authProvider = new firebase.auth.GoogleAuthProvider();
this.angularFireAuth.auth.signInWithRedirect(authProvider);
}
logout() {
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { environment } from '../environments/environment';
@NgModule({
imports: [
export const environment = {
production: false,
firebase: {
apiKey: '<your-key>',
authDomain: '<your-project-authdomain>',
databaseURL: '<your-database-URL>',
projectId: '<your-project-id>',
storageBucket: '<your-storage-bucket>',
messagingSenderId: '<your-messaging-sender-id>'
}
export const getUsersEntities = createSelector(getUsersState, fromUsers.getUsersEntities);
export const getAllUsers = createSelector(getUsersEntities, (entities) => Object.keys(entities).map(id => entities[id]));
export const getUsersLoaded = createSelector(getUsersState, fromUsers.getUsersLoaded);
export const getAdminUsers = createSelector(
getAllUsers,
(users: Users.List): Users.List => users.filter(user => user.isAdmin)
);
this.subscription$ = this.store.select(fromStore.getAllUsers).subscribe(users => {
... // do something with data
this.users = users // just an example
}
//on destroy
this.subscription$.unsubscribe();
<ul>
<li *ngFor="let user of users">...</li>
</ul>
this.users$ = this.store.select(fromStore.getAllUsers);
<ul>
<li *ngFor="let user of $users | async">...</li>
</ul>