Skip to content

Instantly share code, notes, and snippets.

View tomtobac's full-sized avatar

Tomeu tomtobac

View GitHub Profile
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist"
},
"include": ["src"],
"HotPink",
"PeachPuff",
"Crimson",
"BurlyWood",
"CornflowerBlue",
"Thistle",
"Gold",
@tomtobac
tomtobac / publish-and-play-video-composer.js
Last active August 29, 2022 10:21
Publish and play a video in video-composer
// Get video url from context which has been passed by ExtensionEnvironment when we create a MediaProcessor
const videoUrl = window.context.ENV_videoUrl;
const videoClip = document.getElementById('video'); // Your video element <video id="video"></video>
videoClip.src = videoUrl;
videoClip.load();
const stream = video.captureStream();
const videoClipStream = stream.getVideoTracks()[0];
videoClip.play();
@tomtobac
tomtobac / play-media-file-customer-composer.js
Last active August 29, 2022 10:19
Play a video inside of custom video-composer
const videoUrl = window.context.ENV_videoUrl;
const videoClip = document.getElementById('video'); // Your video element <video id="video"></video>
videoClip.src = videoUrl;
videoClip.load();
// If we want to play the video right away
videoClip.play();
videoClip.addEventListener(
'ended',
() => {
@tomtobac
tomtobac / publish-media-file.js
Last active August 29, 2022 10:22
Publish a video into Twilio Video Room
const videoClip = document.getElementById("video"); // Your video element <video id="video"></video>
const stream = video.captureStream();
const videoClipStream = stream.getVideoTracks()[0];
// Create a new LocalVideoTrack
const videoTrack = new Video.LocalVideoTrack(videoClipStream, {
name: "video-composer-presentation",
});
// Publish the LocalVideoTrack to the Room
@tomtobac
tomtobac / circles.html
Created November 30, 2018 10:43
circles
<div
class="u-margin-bottom--huge u-display--flex u-justify-content--center u-align-items--center"
>
<svg height="45" width="45">
<circle
cx="22.5"
cy="22.5"
r="22.5"
stroke-width="1"
fill="#40b28c"
@tomtobac
tomtobac / singelton.ts
Created September 13, 2018 13:57
Singelton typescript
class AuthService {
private static instance: AuthService;
private _counter: number = 0;
constructor() {
console.log('AuthService constructor')
}
public static getInstance() {
console.log('AuthService getInstance')
if (!AuthService.instance) {
AuthService.instance = new AuthService();
@tomtobac
tomtobac / .py
Last active October 30, 2017 14:26
[GIT-HOOK] attach task to the commit.
#!/usr/bin/env python
""" to enable this hook:
replace the file prepare-commit-msg.sample
under (.git/hooks/) without the sample preffix.
Eg: We're in the branch: feature/ABC-123-fix-this-ASAP
when we push our commit it will be refactored as "[ABC-123] my commit"
"""
import subprocess, sys
commit_msg_filepath = sys.argv[1]
<table>
<thead>
<tr>
<th><a href (click)="sortTable('company')">Company</a></th>
<th><a href (click)="sortTable('domain')">Domain</a></th>
<th><a href (click)="sortTable('info.country')">Country</a></th>
<th><a href (click)="sortTable('info.cash')">Cash</a></th>
</tr>
</thead>
<tbody>
export class AppComponent implements OnInit {
companies: Company[];
path: string[] = ['company'];
order: number = 1; // 1 asc, -1 desc;
constructor(private dataService: MockDataService) {}
ngOnInit(): void {
this.companies = this.dataService.getCompanies();