This file contains hidden or 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 random | |
months = 3 | |
every_n_seconds = 5 | |
points = [] | |
for i in range(months * 30 * 24 * 60 * 60 // every_n_seconds): | |
points.append([i, random.randint(1, 100)]) | |
with open("data.csv", "w") as f: |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: nginx | |
template: |
This file contains hidden or 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
version: "3.9" | |
services: | |
web: | |
build: . | |
ports: | |
- "5000:5000" | |
redis: | |
image: "redis:alpine" |
This file contains hidden or 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
$result = $repository?->getUser(5)?->name; |
This file contains hidden or 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
<? | |
if (is_null($repository)) { | |
$result = null; | |
} else { | |
$user = $repository->getUser(5); | |
if (is_null($user)) { | |
$result = null; | |
} else { | |
$result = $user->name; | |
} |
This file contains hidden or 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
class Person { | |
public function __construct( | |
private string $firstName, | |
private string $lastName, | |
protected int $age, | |
public ?string $job | |
){} | |
} |
This file contains hidden or 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
class Person { | |
private string $firstName; | |
private string $lastName; | |
protected int $age; | |
public ?string $job; | |
public function __construct( |
This file contains hidden or 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
class Person { | |
public string $firstName; | |
public string $lastName; | |
public int $age; | |
public ?string $job; | |
} |
This file contains hidden or 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
func parseWithBlackMagic(inputString string) int { | |
isAm := inputString[len(inputString)-2] == 'A' | |
number := int(inputString[0]) - '0' | |
if len(inputString) > 3 { | |
number = number*10 + int(inputString[1]) - '0' | |
} | |
if !isAm { | |
number += 12 |
This file contains hidden or 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
func parseWithStringManipulationWithoutHasSuffix(inputString string) int { | |
isAm := inputString[len(inputString)-2] == 'A' | |
number, _ := strconv.Atoi(inputString[:len(inputString) - 2]) | |
if !isAm { | |
number += 12 | |
} | |
return number | |
} |
NewerOlder