-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
79 lines (45 loc) · 1.41 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
use Illuminate\Support\Collection;
use Illuminate\Support\Carbon;
require_once 'vendor/autoload.php';
include 'functions.php';
$products = collect(load_json('products.json')['products']);
var_dump($products->all());
// $totalCost = 0;
// foreach ($products as $product) {
// if ($product['product_type'] == 'Lamp' || $product['product_type'] == 'Wallet') {
// foreach ($product['variants'] as $variant) {
// $totalCost += $variant['price'];
// }
// }
// }
// $totalCost = $products->filter( function ($product) {
// // return $product['product_type'] == 'Lamp' || $product['product_type'] == 'Wallet';
// return $product['product_type'] == 'Pants';
// })->flatMap( function ($product) {
// return $product['variants'];
// })->sum('price');
// dd($totalCost);
// $shifts =[
// 'Shipping Stive_Robi_H4',
// 'Analogi_Lore_T5',
// 'Smarti_Dun_U7',
// 'Harmon_Mato_Y78'
// ];
// $shiftIds = collect($shifts)->map( function($shift) {
// return collect(explode('_',$shift))->last();
// });
// var_dump($shifts);
// convert binary to decimal
// $binary = '1110000111010101010';
// $columns = collect(str_split($binary))
// ->reverse()->values()->map( function($column, $index) {
// return $column * (pow(2, $index));
// })->sum();
// var_dump($columns);
// function gitHubScores($events)
// {
// //
// }
// $events = load_json('events.json');
// dd(gitHubScores($events));