Skip to content

Instantly share code, notes, and snippets.

View t8g's full-sized avatar

Thomas Moyse t8g

  • ByteClub
  • Nantes
View GitHub Profile
@t8g
t8g / index.html
Last active January 8, 2020 14:15
yellow zone
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<script>
class CleImage extends HTMLElement {
constructor() {
@t8g
t8g / frais.ts
Last active February 16, 2018 11:46
Partage des frais
interface Friend {
id: number;
name: string;
expense: number;
}
interface Transaction {
from: number;
to: number;
value: number;
@t8g
t8g / SimpleObservable.ts
Created January 29, 2018 14:30
Naïve Observable implementation
// 1. une source de données
class DataSource {
ondata: (data: number) => void = () => { };
interval: number;
constructor() {
let i = 0;
this.interval = setInterval(() => this.emit(++i), 1000);
}
// reverse_test.js
module.exports = {
'Test reverse input' : function (browser) {
browser
.url('http://localhost:4200')
.waitForElementPresent('bc-reverse', 1000)
.setValue('bc-reverse input', 'ByteClub')
.pause(1000);
browser.expect.element('bc-reverse strong').text.to.equal('bulCetyB');
// byteclub_test.js
module.exports = {
'Test ByteClub website' : function (browser) {
browser
// On navigue vers une url
.url('http://byteclub.fr')
// On clique sur un lien (trouvé avec un selecteur css)
.click('.nav.nav-main li:nth-child(5) a')
// et on attend un peu
.pause(1000);
// byteclub_test.js
module.exports = {
'Test ByteClub website' : function (browser) {
browser
.url('http://byteclub.fr')
.click('.nav.nav-main li:nth-child(5) a')
.pause(1000);
browser.expect.element('h1.page-title').text.to.contains('Qui sommes nous ?');
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true
"webdriver": "webdriver-manager start",
"nw": "wait-on http://localhost:4444 && nightwatch"
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'reverse'
})
export class ReversePipe implements PipeTransform {
transform(value: string): string {
return value.split('').reverse().join('');
}
import { Component } from '@angular/core';
@Component({
selector: 'bc-reverse',
template: `
<input [(ngModel)]="value">
<strong>{{ value | reverse }}</strong>
`
})
export class ReverseComponent {