Skip to content

Instantly share code, notes, and snippets.

@luza
luza / main.go
Last active Aug 6, 2019
First untested(!) implementation of traffic-lights-demo
View main.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
View PgSqlNativeQueryCursor.php
<?php
namespace AppBundle\Doctrine;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDOPgSql\Driver as PDOPgSqlDriver;
use Doctrine\ORM\NativeQuery;
class PgSqlNativeQueryCursor
{
@luza
luza / ean13_generator.sql
Last active May 26, 2018
EAN13 barcode generator example plpgsql postgres
View ean13_generator.sql
with recursive source as (
select (220000000000::bigint + round(random() * 10000000000))::bigint as code
from generate_series(1, 10000)
),
checksum_calc as (
select code, 3 as cs_mult, 0::bigint as checksum, code as interm_code from source
union
select
code,
(case when cs_mult = 3 then 1 else 3 end) as cs_mult,