This file contains 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 { Injectable } from '@angular/core'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class CSVService { | |
async toJSON(str: string, delimiter: string) { | |
// `\\${delimiter}(?=\S)\\` | |
const regExp = new RegExp(delimiter); |
This file contains 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 { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({name: 'groupBy'}) | |
export class GroupByPipe implements PipeTransform { | |
transform(value: Array<any>, objKey: string): Array<any> { | |
// prevents the application from breaking if the array of objects doesn't exist yet | |
if (!value) { | |
return null; | |
} | |
const groupedCollection = value.reduce((previous, current) => { |
This file contains 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
export const flatMap = (fn, arr: any[]): any[] => [].concat.apply([], arr.map(fn)); |
This file contains 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, Input, AfterViewInit, Output, EventEmitter, ViewChild, ElementRef, ChangeDetectorRef } from '@angular/core'; | |
import olMap from 'ol/Map'; | |
import View from 'ol/View'; | |
import TileLayer from 'ol/layer/Tile'; | |
import XYZ from 'ol/source/XYZ'; | |
import WebGLPointsLayer from 'ol/layer/WebGLPoints'; | |
import { LiteralStyle, SymbolType } from 'ol/style/LiteralStyle'; | |
import { Feature } from 'ol'; | |
import { fromLonLat } from 'ol/proj'; | |
import Point from 'ol/geom/Point'; |
This file contains 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
const path = require('path'); | |
const HtmlWebPackPlugin = require("html-webpack-plugin"); | |
module.exports = { | |
entry: './src/app/app.js', | |
output: { | |
filename: 'main.js', | |
path: path.resolve(__dirname, 'dist') | |
}, | |
resolve: { |
This file contains 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
const ytadkiller = () => { | |
if (window['yt-add-skiper-init']) | |
window['yt-add-skiper-init'].clearInterval(); | |
// init counter | |
window['yt-add-skiper-count'] = 0; | |
// init | |
window['yt-add-skiper-init'] = setInterval(_=> { | |
const el = document.querySelector('.ytp-ad-skip-button.ytp-button'); | |
if (!el) return; | |
// count |
This file contains 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
// Based off of Shawn Van Every's Live Web | |
// http://itp.nyu.edu/~sve204/liveweb_fall2013/week3.html | |
// Using express: http://expressjs.com/ | |
var express = require('express'); | |
// Create the app | |
var app = express(); | |
// Set up the server | |
// process.env.PORT is related to deploying on heroku |
This file contains 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
/** | |
* EXO FETCH et MANIPULATION DES DONNÉES | |
* DOC API: https://timetable.search.ch/api/help.en.html | |
* */ | |
// APPLICATION CFF SIMPLE: | |
const buildSearchHTML = () => { | |
const contener = document.querySelector('#cffApp'); | |
contener.innerHTML = ` | |
<input id="from" type="text" /> |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<base href="./"> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<script src="./main.esm.js"></script> | |
</head> |