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: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: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:3671773
Created September 8, 2012 04:24
Array multidimensional unique
<?php
$lista = array_map('unserialize', array_unique(array_map('serialize', $listaAtual)));
@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: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: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
<?php
try{
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$this->get('session')->setFlash('notice', 'Article inserted!');
return $this->redirect($this->generateUrl('article_show', array('id' => $entity->getId())));
}catch(\Exception $e){
@andreia
andreia / AddExpiresAtFieldSubscriber.php
Created January 23, 2013 01:41
Adding (and/or Removing) fields using Event Subscribers
<?php
// src/Bundle/Form/EventListener/AddExpiresAtFieldSubscriber.php
class AddExpiresAtFieldSubscriber implements EventSubscriberInterface
{
private $factory;
public function __construct(FormFactoryInterface $factory)
{
$this->factory = $factory;
@andreia
andreia / gist:4601078
Created January 23, 2013 01:51
Symfony2: Using absolute URLs for your assets
(e.g. for email templates)
Just set the assets_base_urls option under framework - templating key in your app/config/config.yml:
framework:
templating:
assets_base_urls: http://www.something.com/web/
http://symfony.com/doc/current/reference/configuration/framework.html#assets-base-urls
@andreia
andreia / composer.json
Created March 7, 2013 11:14
From Symfony 2.1 to 2.2
diff --git a/composer.json b/composer.json
index 8f905d7..c2d7588 100644
--- a/composer.json
+++ b/composer.json
@@ -6,18 +6,18 @@
},
"require": {
"php": "&gt;=5.3.3",
- "symfony/symfony": "2.1.*",