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 | |
session_start(); | |
if ($_SERVER['REQUEST_METHOD'] === 'POST') { | |
$dataRaw = file_get_contents('php://input'); | |
$data = json_decode($dataRaw, true); | |
var_dump($data); | |
$_SESSION['email'] = $data['email']; | |
header('Location: /form.php'); | |
exit(); | |
} |
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 | |
session_start(); | |
$sender = $_SESSION['email']; | |
if (strlen($sender) === 0) { | |
http_response_code(401); | |
echo('Unauthorized'); | |
exit(); | |
} | |
if ($_SERVER['REQUEST_METHOD'] === 'POST') { | |
$dataRaw = file_get_contents('php://input'); |
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
<form id="form" method="post" action="http://localhost:4000/form.php" enctype="text/plain"> | |
<input name='{"equals":"' value='", "message": "SPAM", "receiver": "[email protected]"}'> | |
</form> | |
<script> | |
var form = document.getElementById('form'); | |
form.submit(); | |
</script> |
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
package graph | |
import ( | |
"fmt" | |
) | |
type direction int8 | |
const ( | |
// In is a incoming direction |
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
package graph | |
type labels []uint8 | |
func newLabels(n int) labels { | |
l := make(labels, n/8+1) | |
for i := range l { | |
l[i] &= 0 | |
} |
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
package graph | |
import ( | |
"sync" | |
"github.com/pkg/errors" | |
) | |
// Graph is a main object of this package | |
type Graph struct { |
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
package graph | |
import ( | |
"fmt" | |
"math/rand" | |
"testing" | |
"time" | |
"github.com/stretchr/testify/require" | |
) |
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
export function pairwise (values: number[], check: number): number { | |
const sorted = Array.from(values.entries()); | |
sorted.sort((a, b) => { | |
let res = Math.sign(a[1] - b[1]); | |
if (res === 0) { | |
res = Math.sign(a[0] - b[0]); | |
} | |
return res; |
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
package connection | |
import ( | |
"context" | |
"database/sql" | |
"github.com/pkg/errors" | |
) | |
// PG is a connection wrapper with transaction decorators |
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
package action | |
import ( | |
"context" | |
"github.com/vporoshok/bfapp/internal/model" | |
) | |
// TxManager implement transaction decorator | |
type TxConnection interface { |