This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type User struct { | |
| Name: string `db:"name"` | |
| Age: int `db:"age"` | |
| Email: string `db:"email"` | |
| Username: string `db:"username"` | |
| } | |
| users := []User{} | |
| db.ExecuteSelect(users, query) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .message { | |
| padding: 10px; | |
| border-radius: 10px; | |
| margin-bottom: 4px; | |
| white-space: pre-wrap; | |
| } | |
| .my-message { | |
| background: var(--ion-color-tertiary); | |
| color: #fff; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ion-header> | |
| <ion-toolbar> | |
| <ion-title> | |
| Devdactic Chat | |
| </ion-title> | |
| </ion-toolbar> | |
| </ion-header> | |
| <ion-content> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, OnInit } from '@angular/core'; | |
| import { Socket } from 'ngx-socket-io'; | |
| import { ToastController } from '@ionic/angular'; | |
| @Component({ | |
| selector: 'app-home', | |
| templateUrl: 'home.page.html', | |
| styleUrls: ['home.page.scss'], | |
| }) | |
| export class HomePage implements OnInit { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NgModule } from '@angular/core'; | |
| import { BrowserModule } from '@angular/platform-browser'; | |
| import { RouteReuseStrategy } from '@angular/router'; | |
| import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; | |
| import { SplashScreen } from '@ionic-native/splash-screen/ngx'; | |
| import { StatusBar } from '@ionic-native/status-bar/ngx'; | |
| import { AppComponent } from './app.component'; | |
| import { AppRoutingModule } from './app-routing.module'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ionic start myIonicApp blank | |
| cd ./myIonicApp | |
| npm install ngx-socket-io |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node index.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let app = require('express')(); | |
| let server = require('http').createServer(app); | |
| let io = require('socket.io')(server); | |
| io.on('connection', (socket) => { | |
| socket.on('disconnect', function(){ | |
| io.emit('users-changed', {user: socket.username, event: 'left'}); | |
| }); | |
| socket.on('set-name', (name) => { | |
| socket.username = name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir backSocket && cd backSocket | |
| npm init | |
| npm install express socket.io |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .bounding-box { | |
| position: absolute; | |
| box-shadow: 0 0 0 3px #fff inset; | |
| display: flex; | |
| flex-wrap: wrap; | |
| justify-content: center; | |
| cursor: pointer; | |
| } | |
NewerOlder