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
-- search | |
-- Perform a full text search in I18N using HStore | |
-- @param text $1 the language to search | |
-- @param text $2 the search string | |
-- @return int4 id The identifier of the searched table | |
-- @return float4 rank The ranking function result. | |
-- @return text excerpt An extract of text containing the searched words surrounded with <strong>.</strong>. | |
CREATE OR REPLACE FUNCTION test.search(text, text) RETURNS TABLE (id int4, rank float4, excerpt text) LANGUAGE sql AS $_$ | |
SELECT |
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
[alias] | |
st = status | |
mylog = "log --graph --pretty=format:'%h %C(bold white)%d%Creset - %C(green)%an%Creset, %C(bold red)%ar%Creset - %C(bold yellow)%s%Creset'" |
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 Taf\Member; | |
use Taf\Member\Base\SessionMap as BaseSessionMap; | |
use Taf\Member\Session; | |
use \Pomm\Exception\Exception; | |
use \Pomm\Query\Where; | |
use \Pomm\Object\BaseObject; |
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 application.php | |
// ... | |
$app->post('/tasks/new', function() use ($app) { | |
$task_map = $app['pomm.connection'] | |
->getMapFor('\Taf\Task\Task'); | |
$new_task = new Validation\NewTask($app['request']->request->get('new_task')); | |
$new_task->worker_id = $app['taf.session']->getWorkerId(); | |
if (count($app['validator']->validate($new_task)) == 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
During this session we will explore Postgresql's unique features like writeable CTEs, window functions, Json, XML and key-value support and much more. We will see how with Pomm's elastic objects it makes web developers able to have a model layer decoupled from the underlying data structure with a minimal complexity data preparation code. | |
Postgresql 9.2 is probably the most known version of Postgres since it exists. This can be partly explained by the fuss about web oriented features like Json and HStore data types and javascript v8 support for stored functions. But it is not the only reason. Its rich types sets allow programers to think data as objects in their SQL queries. | |
Today's ORMs link static classes to tables, preventing the developers from creating their own business oriented data sets. They must then prepare the data to format them the right way in the model layer before applying business rules. | |
Pomm is a model manager. It maps PHP elastic classes to data sets provided either by tables, views or… |
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
#!/bin/bash | |
mkdir -p bin sources/{config,twig,sql,lib/{Model,Controller}} web/{css,images,js} tests documentation log | |
chmod 777 log | |
> web/favicon.ico | |
cat > bin/generate_model.php <<"EOF" | |
<?php // bin/generate_model.php | |
$app = require(__DIR__."/../sources/bootstrap.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
CREATE TABLE node (name varchar PRIMARY KEY, is_child_of varchar REFERENCES node (name), some_int integer NOT NULL); | |
CREATE INDEX node_is_child_of_idx ON node (is_child_of); | |
-- Fill the table with nice big random tree | |
WITH RECURSIVE | |
path_node AS ( | |
SELECT | |
md5(chr(CAST(floor(random() * 223) AS integer) + 32) || random()) AS name, | |
NULL AS is_child_of, | |
0 AS some_int, |
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
" Vim syntax file | |
" Language: SQL, PGSQL (postgres 9.1) | |
" Last Change: 2012 May 21st | |
" Maintainer: Grégoire Hubert <greg DOT hubert AT gmail DOT com> | |
" Based on the work of Paul Moore <pf_moore AT yahoo.co.uk> | |
" For version 5.x: Clear all syntax items | |
" For version 6.x: Quit when a syntax file was already loaded | |
if version < 600 | |
syntax clear |
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
Version 4 | |
SHEET 1 1188 920 | |
WIRE -176 -480 -176 -560 | |
WIRE -1136 -432 -1200 -432 | |
WIRE -992 -432 -1056 -432 | |
WIRE 448 -400 320 -400 | |
WIRE -576 -352 -896 -352 | |
WIRE -176 -352 -176 -400 | |
WIRE -176 -352 -512 -352 | |
WIRE 320 -336 320 -400 |
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
function splitw() { | |
tmux split-window "$*"; | |
} | |
function neww() { | |
tmux new-window "$*"; | |
} |