Skip to content

Instantly share code, notes, and snippets.

FROM alpine:3.17 AS ext-build
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk add --no-cache \
build-base \
c-ares-dev \
curl-dev \
librdkafka-dev \
mpdecimal-dev \
openssl-dev \
php82-dev \
class FiguraGeometrica a where
area :: a -> Int
data Circulo = Circulo { raio :: Int }
data Quadrado = Quadrado { lado :: Int }
instance FiguraGeometrica Circlo a where a
area = 3.14 * (a raio) ** 2
instance FiguraGeometrica Quadrado a where a
I know why you folks are so confused about this; it is because usually PHP is used on the web as some kind of HTML pre-processor, then you might think that every output on PHP is some HTML, but that is not quite right. Output is output like any other, just a piece of text, the PHP interpreter doesn't know and doesn't care what type of format you are outputting, for it it is just some text, that is why you can implement APIs that outputs some JSON or XML "instead". What your text might represent is NOT defined in the PHP interpreter when it is outputting something, that is why is wrong to say it is HTML, it is just some regular text, exactly like doing echo.
import {useEffect, useState} from "react";
interface CEP {
cep: string,
state: string,
city: string,
street: string,
neighborhood: string
}
<?php
$input = fopen('data.csv', 'r');
$output = fopen('output.csv', 'w');
$pdo = new PDO('sqlite:db.sqlite');
if (false === $pdo->exec('create table if not exists foo (bar varchar, baz varchar)')) {
print_r($pdo->errorInfo());
exit(1);
}
#!/usr/bin/env php
<?php declare(strict_types=1);
use Siler\Route;
use function Siler\Swoole\{graphql_handler, http};
require_once __DIR__ . '/bootstrap.php';
global $schema, $root_value, $context;
$handler = graphql_handler($schema, $root_value, $context);
Province/State Country/Region Lat Long 1/22/20 1/23/20 1/24/20 1/25/20 1/26/20 1/27/20 1/28/20 1/29/20 1/30/20 1/31/20 2/1/20 2/2/20 2/3/20 2/4/20 2/5/20 2/6/20 2/7/20 2/8/20 2/9/20 2/10/20 2/11/20 2/12/20 2/13/20 2/14/20 2/15/20 2/16/20 2/17/20 2/18/20 2/19/20 2/20/20 2/21/20 2/22/20 2/23/20 2/24/20 2/25/20 2/26/20 2/27/20 2/28/20 2/29/20 3/1/20 3/2/20 3/3/20 3/4/20 3/5/20 3/6/20 3/7/20 3/8/20 3/9/20 3/10/20 3/11/20 3/12/20 3/13/20 3/14/20 3/15/20 3/16/20 3/17/20 3/18/20 3/19/20 3/20/20 3/21/20
Brazil -14.235 -51.9253 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 2 2 2 2 4 4 13 13 20 25 31 38 52 151 151 162 200 321 372 621 793 1021
<?php
function strtotitle(string $str): string {
$title = mb_convert_case($str, MB_CASE_TITLE);
// Edge cases
return preg_replace_callback_array([
"/('[a-z])/" => fn ($m) => strtoupper($m[1]),
"/(\s(?:D(o|a)s?)\s)/" => fn ($m) => strtolower($m[1]),
], $title);
class Event {
int idColumn;
int idSchedule;
Event(this.idColumn, this.idSchedule);
String toString() => 'Col $idColumn - Sched $idSchedule';
}
class Exclusion {
String date;
int idSchedule;
class Foo {
String foo;
Foo(this.foo);
String toString() => foo;
}
void main() {
final map = <DateTime, List<dynamic>>{
DateTime(2010, 10, 10): [Foo("bar"), Foo("baz"), Foo("qux")],
DateTime(2011, 10, 10): [Foo("bar"), Foo("baz"), Foo("qux")],