Skip to content

Instantly share code, notes, and snippets.

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:
@karakanb
karakanb / AuthController.php
Created June 13, 2017 12:23
Laravel - Google Analytics oAuth Implementation
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use Auth;
use Session;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
@karakanb
karakanb / docker-compose.yml
Last active June 6, 2021 11:37
A simple docker-compose example
version: '3'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
environment:
FLASK_ENV: development
version: "3.9"
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"
$result = $repository?->getUser(5)?->name;
<?
if (is_null($repository)) {
$result = null;
} else {
$user = $repository->getUser(5);
if (is_null($user)) {
$result = null;
} else {
$result = $user->name;
}
class Person {
public function __construct(
private string $firstName,
private string $lastName,
protected int $age,
public ?string $job
){}
}
class Person {
private string $firstName;
private string $lastName;
protected int $age;
public ?string $job;
public function __construct(
class Person {
public string $firstName;
public string $lastName;
public int $age;
public ?string $job;
}