Skip to content

Instantly share code, notes, and snippets.

View FazioNico's full-sized avatar
🏴‍☠️

Nicolas Fazio FazioNico

🏴‍☠️
View GitHub Profile
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class CSVService {
async toJSON(str: string, delimiter: string) {
// `\\${delimiter}(?=\S)\\`
const regExp = new RegExp(delimiter);
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) => {
export const flatMap = (fn, arr: any[]): any[] => [].concat.apply([], arr.map(fn));
@FazioNico
FazioNico / ng-ol.component.ts
Created May 18, 2020 08:32
Component to display Open Layer Map with Angular
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';
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: {
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
// 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
@FazioNico
FazioNico / cff.js
Last active December 1, 2020 16:48
[For Student]: Build Simple CFF Timetable Application
/**
* 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" />
@FazioNico
FazioNico / excel-to-json.html
Last active September 2, 2021 17:37
Convert EXCEL file to JSON Object from browser using Javascript
<!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>
<!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>