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
<?php | |
namespace App\Http\Controllers; | |
use App\Http\Requests\UrlRequest; | |
use App\Model\Url; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Validator; |
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
<table border="1"> | |
<tr> | |
<td rowspan="4">11</td> | |
<td rowspan="2">11</td> | |
<td>11</td> | |
<td>11</td> | |
<td>11</td> | |
</tr> | |
<tr> |
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 boto3 | |
import urllib.request | |
from botocore.exceptions import ClientError | |
METADATA_URL = 'http://169.254.169.254/latest/meta-data' | |
instance_id = urllib.request.urlopen(METADATA_URL + '/instance-id').read().decode() | |
current_eip = urllib.request.urlopen(METADATA_URL + '/public-ipv4').read().decode() |
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
<?php //framework/src/app.php | |
use Symfony\Component\Routing; | |
use Symfony\Component\HttpFoundation\Response; | |
function is_leap_year($year = null) { | |
if (null === $year) { | |
$year = date('Y'); | |
} |
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
<?php //framework/web/front.php | |
require_once __DIR__.'/../vendor/autoload.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Routing; | |
function render_template($request) | |
{ |
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
<?php //framework/web/front.php | |
// ... | |
try { | |
$request->attributes->add($matcher->match($request->getPathInfo())); | |
$response = call_user_func('render_template', $request); | |
} catch (Routing\Exception\ResourceNotFoundException $exception) { | |
$response = new Response('Not Found', 404); | |
} catch (Exception $exception) { | |
$response = new Response('An error occurred', 500); |
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
<?php //framework/src/app.php | |
use Symfony\Component\Routing; | |
$routes = new Routing\RouteCollection(); | |
$routes->add( | |
'hello', | |
new Routing\Route( | |
'/hello/{name}', | |
array('name' => 'World') |
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
<!-- example.com/src/pages/hello.php --> | |
Hello <?php echo htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?> | |
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
<?php //framework/web/front.php | |
require_once __DIR__.'/../vendor/autoload.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Routing; | |
$request = Request::createFromGlobals(); | |
$routes = include __DIR__.'/../src/app.php'; |
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
<!-- framework/src/pages/hello.php --> | |
Hello <?php echo htmlspecialchars(isset($name) ? $name : 'World', ENT_QUOTES, 'UTF-8') ?> | |
NewerOlder