This file contains 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
# to find out the configuration commands, run: h2o --help | |
user: www-data | |
hosts: | |
"example.com": | |
listen: | |
host: xx.xx.xx.xx | |
port: 443 |
This file contains 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
# You can run the Huawei E5377 LTE modem as an ethernet device on the Zyxel SBG3300 router | |
# More here: https://kb.zyxel.com/KB/searchArticle!gwsViewDetail.action?articleOid=013274&lang=EN | |
Short info: | |
$ telnet 192.168.1.1 | |
$ sh | |
$ usb_modeswitch -v 12d1 -p 1f02 -V 4817 -P 5340 -M 55534243123456780000000000000a11062000000000000100000000000000 | |
$ lsusb |
This file contains 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
Here used to be a rough prototype of an | |
implementation, which is now deprecated. | |
in favour of this: | |
https://www.symfony.fi/entry/sharing-state-in-a-symfony-hybrid-app-with-twig-react-etc | |
----- | |
Using this approach you can bootstrap a | |
React application on the server side using | |
PHP/Symfony so that your client application |
This file contains 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
public function apiApartmentsAction(Request $request) | |
{ | |
$appState = new AppState(); | |
$em = $this->get('doctrine.orm.default_entity_manager'); | |
$apartments = $em->getRepository('AppBundle:Apartment')->getRandom(10); | |
$appState->setApartments($apartments); | |
$response = new JsonResponse(); |
This file contains 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
var ApartmentListing = Vue.extend({ | |
template: ` | |
<div> | |
<h2>Hello from Vue</h2> | |
<table> | |
<tr v-for="apartment in apartments"> | |
<td> | |
{{ apartment.streetaddress }}<br /> | |
{{ apartment.city }}<br /> | |
{{ apartment.zipcode }} |
This file contains 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
<script type="text/javascript"> | |
var initialAppState = {{ appstate_serialized|raw }}; | |
</script> | |
<script src="{{ asset('bundles/app/js/vue/vue.js') }}"></script> | |
<script src="{{ asset('bundles/app/js/vue/app.js') }}"></script> |
This file contains 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
<h2>Hello from Twig</h2> | |
<table> | |
{% for apartment in appstate.apartments %} | |
<tr> | |
<td> | |
{{ apartment.streetaddress }}<br /> | |
{{ apartment.city }}<br /> | |
{{ apartment.zipcode }} | |
</td> | |
<td>{{ apartment.country }}</td> |
This file contains 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
<?php | |
public function indexAction(Request $request ) | |
{ | |
$appState = new AppState(); | |
$em = $this->get('doctrine.orm.default_entity_manager'); | |
$apartments = $em->getRepository('AppBundle:Apartment')->findByLimit(3); | |
$appState->setApartments($apartments); | |
$appState->setFetchMore(true); |
This file contains 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
<?php | |
namespace AppBundle\State; | |
use Symfony\Component\Serializer\Serializer; | |
use Symfony\Component\Serializer\Encoder\JsonEncoder; | |
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; | |
class AppState implements \JsonSerializable { | |
public $fetchMore = false; |
This file contains 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
{{ render_esi( | |
controller( | |
"Foo:Default:bar", | |
{ | |
'bar': foo, | |
} | |
) | |
) }} |