Skip to content

Instantly share code, notes, and snippets.

View tgalopin's full-sized avatar

Titouan Galopin tgalopin

View GitHub Profile
// assets/controllers/app_controller.jsx
import React from 'react';
import { render } from 'react-dom';
import { Controller } from 'stimulus';
import App from '../components/App.jsx';
export default class extends Controller {
connect() {
render(<App />, this.element);
@tgalopin
tgalopin / symfony-http-client-async-example.php
Created March 2, 2019 21:26
Symfony HttpClient Async example
<?php
$client = \Symfony\Component\HttpClient\HttpClient::create();
// Create a few requests: this is entierely async, requests are launched in the background
$request1 = $client->request('GET', 'http://releases.ubuntu.com/18.04.2/ubuntu-18.04.2-desktop-amd64.iso?request=a');
$request2 = $client->request('GET', 'http://releases.ubuntu.com/18.04.2/ubuntu-18.04.2-desktop-amd64.iso?request=b');
$request3 = $client->request('GET', 'http://releases.ubuntu.com/18.04.2/ubuntu-18.04.2-desktop-amd64.iso?request=c');
// The code continues execution immediatly, you can do whathever you want here ...
const forest = [/* ... */];
let forestKey = 0;
let childKey = 0;
let isChild = {};
// O(n) loop
while (true) {
// O(1) : access by key to a hash map
if (typeof forest[forestKey] === 'undefined') {
services:
digitalocean_spaces_client:
class: 'AsyncAws\S3\S3Client'
arguments: # ...
flysystem:
storages:
cdn.storage.memory:
adapter: 'memory'

Answering https://twitter.com/karlhorky/status/1083028945258405888

IMO there are two main large groups of programming languages: those describing how to solve a problem and those describing the problem to solve itself.

That's my definition of declarative vs dynamic languages. A declarative language only describe what the problem is and in which context we are, then let an engine interpret these descriptions to act accordingly. There is no "logic" in the sense that in a declarative language, there is no "execution flow".

Dynamic languages, on the other hand, are much more generic: they don't describe what the problem is, they are used to express how to solve the problem. In a sense, they are closer to the hardware: you will need a

<?php
namespace App\Tests\Controller;
use Symfony\Component\HttpFoundation\Response;
/**
* @group functional
*/
class SecurityControllerTest extends AbstractControllerTest

Keybase proof

I hereby claim:

  • I am tgalopin on github.
  • I am tgalopin (https://keybase.io/tgalopin) on keybase.
  • I have a public key whose fingerprint is 76E1 D39D ED61 6A43 7CC3 E569 770C 1744 BBF5 0258

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am tgalopin on github.
  • I am tgalopin (https://keybase.io/tgalopin) on keybase.
  • I have a public key ASABkpEc3xQN016FUZWrUm8gX08Gw42C19PR-OeKLuzitAo

To claim this, I am signing this object:

<?php
class Foo implements ServiceSubscriberInterface
{
use ServiceSubscriberTrait;
public function do()
{
$this->getRouter();
}
2.1 ou version ultérieure
2.1 ou version ultérieure
2.1 and up
2.1 and up
2.1 and up
2.1 en hoger
2.1 ve üzeri
2.1 tai uudempi
2.1 és újabb
2.1 un jaunāka