Skip to content

Instantly share code, notes, and snippets.

@nini
nini / Indexes as SQL.sql
Last active November 16, 2016 20:36
Get complete index list for particular table as SQL
select pg_get_indexdef(idx.oid)||';'
from pg_index ind
join pg_class idx on idx.oid = ind.indexrelid
join pg_class tbl on tbl.oid = ind.indrelid
left join pg_namespace ns on ns.oid = tbl.relnamespace
where tbl.relname = 'mytablename'
and ns.nspname = 'public';
@jrfnl
jrfnl / _readme.md
Last active June 4, 2023 17:12
PHPUnit xslt

###PHPUnit logfile XLST template

This fileset provides an easy way to view the PHPUnit XML (JUnit) logfiles in a human readable manner using a web browser.

Use this either in combination with the accompanying html file or add the following tag straight after the xml opening tag of the logfile: <?xml-stylesheet type="text/xsl" href="phpunit.xslt"?>

The thresholds used for the colour-coding and whether or not to show detail for successfull tests can be changed by adjusting the variables at the top of the xslt file.

@MadaraUchiha
MadaraUchiha / mysql_comment.markdown
Last active May 9, 2019 23:07
Don't use MySQL functions in PHP - Comment for Stack Overflow
[**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained [and are officially deprecated](http://j.mp/XqV7Lp). See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ).

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

@miyagawa
miyagawa / gist:1912431
Created February 26, 2012 02:53
How to represent Links in REST

How to embed HATEOAS/Link inside JSON

HTTP Headers

For HTTP headers it's quite straightforward: draft-nottingham-http-link-header defines this.

Link: <http://example.com/>; rel="previous"; titile="Previous chapter"
@mamund
mamund / gist:794419
Created January 25, 2011 02:39
JSON Link Standardization Examples
/* some suggestions on implementing hyperlinks in json */
// 5988-style (http://tools.ietf.org/html/rfc5988)
{ "link" :
{
"href" : "...",
"rel" : "...",
"hreflang" : "...",
"media" : "...",
"title" : "...",