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
<?php | |
$obj = array( | |
"Name" => "Jon Snow", | |
"Info" => array( | |
"Age" => "17", | |
"House" => "Winterfell" | |
), | |
"Current Duty" => "Lord Commander" | |
); | |
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
'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 => { |
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
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') |
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
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) |
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
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) | |
}) |
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
<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 |
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 class Company { | |
constructor( | |
public company: string, | |
public domain: string, | |
public info: { | |
country: string, | |
cash: number | |
} | |
) {} | |
} |
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 { 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[] { |
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 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(); |
OlderNewer