Skip to content

Instantly share code, notes, and snippets.

<?php
use Predis\Client;
class RedisSession implements SessionHandlerInterface {
private $redis;
private $keyPrefix;
private $maxLifetime;
/**
@jl-
jl- / PHP Smarty
Created September 24, 2014 12:01
Sync from Codist...
> PHP Smarty
---
```
<?php
require '../global/libs/Smarty/Smarty.class.php';
class ViewManager extends Smarty{
public function __construct(){
parent::__construct();
header['Content-Type'] = undefined;
upstream project {
server 22.22.22.2:3000;
server 22.22.22.3:3000;
server 22.22.22.5:3000;
}
server {
listen 80;
location / {
@jl-
jl- / change_set_1.sql
Created November 7, 2015 15:22 — forked from willmitchell/change_set_1.sql
a non-trivial postgresql data model with nested accounts and support for role based access control.
CREATE TABLE "user" (
id SERIAL PRIMARY KEY NOT NULL,
login VARCHAR(64) NOT NULL UNIQUE
);
CREATE TABLE account (
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(128) NOT NULL,
parent_account_id BIGINT REFERENCES account NULL,
owner_id BIGINT REFERENCES "user" NOT NULL
@jl-
jl- / accounting.sql
Created November 7, 2015 15:22 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@jl-
jl- / 0001-schema.sql
Created November 7, 2015 15:38 — forked from francois/0001-schema.sql
Setup code to find a way to test constraint triggers on PostgreSQL 9.4 using pgprove
CREATE TABLE accounts(
account text not null
, account_kind text not null
, account_id serial not null unique
, primary key(account)
);
CREATE TABLE transactions(
transaction_id uuid not null
@jl-
jl- / gist:08de5257f93f88446570
Created November 7, 2015 15:41 — forked from Kronos11/gist:1039510
account table
delimiter $$
CREATE TABLE `accounts` (
`account_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Account ID',
`account_username` char(32) NOT NULL DEFAULT '' COMMENT 'Account username',
`account_password` char(64) NOT NULL COMMENT 'Account password',
`account_station_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'Account STATION_ID',
`account_level` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Account - CSR Flag',
`account_banned` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Account - Banned Status',
`account_email` char(64) NOT NULL DEFAULT '' COMMENT 'Account - User email',
@jl-
jl- / LearningSQLExample.sql
Created November 7, 2015 15:53 — forked from mahmoudhossam/LearningSQLExample.sql
"Learning SQL" example file converted to PostgreSQL.
/* begin table creation */
create table department
(department_id serial primary key,
name varchar(20) not null
);
create table branch
(branch_id serial primary key,
name varchar(20) not null,
@jl-
jl- / schema.sql
Last active December 4, 2015 04:46
xixi
CREATE DATABASE xixi;
/**
* accounts
*/
CREATE TABLE accounts (
id bigserial UNIQUE NOT NULL,
-- UNIQUE is needed
-- http://www.postgresql.org/docs/9.5/static/datatype-numeric.html#DATATYPE-SERIAL
--