Skip to content

Instantly share code, notes, and snippets.

import { Component, OnInit } from '@angular/core';
import { PlayerService } from '../player.service';
import io from 'socket.io-client';
import { environment } from '../../../environments/environment';
@Component({
selector: 'app-poker',
templateUrl: './poker.component.html',
styleUrls: ['./poker.component.scss']
})
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class PlayerService {
private currentPlayerSource = new BehaviorSubject(0); // 0 is the default value
currentPlayer = this.currentPlayerSource.asObservable();
div {
background-size: cover;
background-position: center;
background-color: rgb(199, 199, 199);
overflow: hidden;
box-sizing: border-box;
width: 100px;
height: 100px;
}
div {
background-size: cover;
background-position: center;
background-color: rgb(199, 199, 199);
overflow: hidden;
box-sizing: border-box;
width: 100px;
height: 100px;
}
<app-image
[domClass]="'video-or-pic'"
[imageUrl]="'https://picsum.photos/seed/'+currentUser.id+'1/500'"
></app-image>
<div
class="{{domClass}}"
[ngStyle]="{'background-image':'url('+imageUrl+')'}"
></div>
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-image',
templateUrl: './image.component.html',
styleUrls: ['./image.component.scss']
})
export class ImageComponent implements OnInit {
@Input() imageUrl: string;
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-image',
templateUrl: './image.component.html',
styleUrls: ['./image.component.scss']
})
export class ImageComponent implements OnInit {
@Input() imageUrl: string;
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-image',
templateUrl: './image.component.html',
styleUrls: ['./image.component.scss']
})
export class ImageComponent implements OnInit {
@Input() imageUrl: string;
class User < ApplicationRecord
def anon_display_name
if self.anonymous_user
self.anonymous_user.display_name
else
nil
end
end