Skip to content

Instantly share code, notes, and snippets.

View andreia's full-sized avatar
❤️
coding

Andréia Bohner andreia

❤️
coding
View GitHub Profile
@andreia
andreia / gist:4156693
Created November 27, 2012 20:07
Markdown to HTML
$ curl --data-binary @README.md -H 'Content-Type:text/plain' https://api.github.com/markdown/raw
@andreia
andreia / gist:3949980
Created October 25, 2012 01:34
Oracle: Foreign constraints
select f.constraint_name, f.table_name tabela_filha, p.table_name tabela_pai
from user_constraints f, user_constraints p
where f.constraint_type = 'R'
and f.r_constraint_name = p.constraint_name
-- constraint_type (http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_1037.htm):
-- R -> Referential (FK)
-- C -> Check constraint on a table
-- P -> Primary Key
-- U -> Unique Key
@andreia
andreia / gist:3876449
Created October 11, 2012 23:46
Symfony2: Easiest way to add an * to required field labels
/* By default, required field labels are rendered with the "required" class */
.required:after {
content: "*";
}
@andreia
andreia / gist:3671773
Created September 8, 2012 04:24
Array multidimensional unique
<?php
$lista = array_map('unserialize', array_unique(array_map('serialize', $listaAtual)));
@andreia
andreia / gist:3354204
Created August 15, 2012 00:29
ORACLE: Show size in Kb of BLOB fields
SELECT round(DBMS_LOB.getlength(A.FILE)/1024) KB FROM MY_TABLE A
@andreia
andreia / gist:3212102
Created July 30, 2012 23:57
ORACLE: Find View created date and last modified date
select o.created,o.last_ddl_time
from user_objects o
where o.object_name='MY_VIEW' and o.object_type='VIEW';
@andreia
andreia / gist:3181898
Created July 26, 2012 12:57
DOCTRINE 1.2: Returns a single value
<?php
$q = Doctrine_Query::create()
->select('a.title as title')
->from('Article a')
->where('a.id = ?', $this->getId());
->fetchOne()->title;
@andreia
andreia / gist:3166741
Created July 23, 2012 22:46
Environment variables that must be set on Windows to connect to a remote Oracle DB(client)
NLS_LANG <lang> - character set, language and territory
TNS_ADMIN <path> - path to tnsnames.ora file
PATH <path> - add location of the Oracle client
@andreia
andreia / gist:3139278
Created July 18, 2012 22:14
Zebra tables with structural pseudo-classes
tr:nth-child(2n+1){ background: ‪#fff‬ }
tr:nth-child(2n+0){ background: ‪#ffffec‬ }
@andreia
andreia / timeout.php
Created July 13, 2012 01:21 — forked from avalanche123/timeout.php
timeouts in php
<?php
class TimeoutException extends RuntimeException {}
class Timeout
{
private $active;
public function set($seconds)
{