Skip to content

Instantly share code, notes, and snippets.

View tomtobac's full-sized avatar

Tomeu tomtobac

View GitHub Profile
<?php
$obj = array(
"Name" => "Jon Snow",
"Info" => array(
"Age" => "17",
"House" => "Winterfell"
),
"Current Duty" => "Lord Commander"
);
'use strict'
// const Promise = require('es6-promise').Promise;
const csv = require('csv-parse')
const fast = require('fast-csv');
const fs = require('fs')
const files = ['csv_1.csv', 'csv_2.csv']
const promises = []
files.forEach(file => {
for(let i = 0; i < 25; i++){
let date = new Date()
date.setDate(date.getDate() - i)
console.log(date.toISOString().slice(0, 10))
}
// new Date('2016-05-23')
fetch(`https://restcountries.eu/rest/v1/all`)
.then((res) => {
return res.json()
})
.then((values) =>{
let array = values
.map(x => {return x.currencies[0];})
//.filter((v, i, a) => a.indexOf(v) === i); // filter unique
array = Array.from(new Set(array)) // filter ES6 way
console.log(array)
fetch(`https://restcountries.eu/rest/v1/all`)
.then((res) => {
return res.json()
})
.then((values) =>{
let array = values
.map(x => {return {name: x.name, code: x.alpha3Code};})
console.log(array.length)
})
<div class="ui sidebar inverted vertical menu">
<!--<div href="#" class="header item">
TravelB2B
</div>-->
<div class="item">
<a class="ui logo icon image" href="/">
<img src="logo.png" alt="Smiley face" height="35" width="35">
</a>
<a href="/" class="b2bheader"><b>Header</b></a>
</div>
<div class="ui grid">
<div class="four wide column">
<div class="ui raised card fluid">
<div class="content">
<!--<div class="header">Cute Dog</div>
<div class="meta">
<span class="category">Animals</span>
</div>-->
<h3 class="ui dividing header">
Dividing Header
export class Company {
constructor(
public company: string,
public domain: string,
public info: {
country: string,
cash: number
}
) {}
}
import { Company } from './../interfaces/company';
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'sortingCompanies'
})
export class SortingCompaniesPipe implements PipeTransform {
transform(companies: Company[], path: string[], order: number): Company[] {
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();