Skip to content

Instantly share code, notes, and snippets.

View Narven's full-sized avatar
👾
Walking to the fridge...

Pedro Luz Narven

👾
Walking to the fridge...
View GitHub Profile
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
<?php
$qs = Doctrine_Query::create()
->from('MyTable1 m')
->leftJoin('m.MyTable2 p');
$res = $qs->execute();
$qs->free();
<?php
$str = '13++56-461.79/27--14-abc';
$filter = filter_var($str,FILTER_SANITIZE_NUMBER_INT);
$onlyDigitsFilterVar = str_replace(array('+', '-'), '', $filter);
$onlyDigitsRegexp1 = preg_replace('/[^\d]/', '', $str);
$onlyDigitsRegexp2 = preg_replace('/[^[:digit:]]/', '', $str); // http://www.php.net/manual/en/regexp.reference.character-classes.php
var_dump($filter); // string(19) "13++56-4617927--14-"
<?php
$q = Doctrine_Query::create()
->select('a.title as title')
->from('Article a')
->where('a.id = ?', $this->getId());
->fetchOne()->title;
$ curl -u user:pass -d status='Hello from shell' http://twitter.com/statuses/update.xml
/* By default, required field labels are rendered with the "required" class */
.required:after {
content: "*";
}
<?php
$lista = array_map('unserialize', array_unique(array_map('serialize', $listaAtual)));
NLS_LANG <lang> - character set, language and territory
TNS_ADMIN <path> - path to tnsnames.ora file
PATH <path> - add location of the Oracle client
$ curl --data-binary @README.md -H 'Content-Type:text/plain' https://api.github.com/markdown/raw
acme_generate_image_service:
class: Acme\Component\GenerateImageConsumer
arguments:
- @logger