This file contains 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
/* | |
* This decorates Handlebars.js with the ability to load | |
* templates from an external source, with light caching. | |
* | |
* To render a template, pass a closure that will receive the | |
* template as a function parameter, eg, | |
* T.render('templateName', function(t) { | |
* $('#somediv').html( t() ); | |
* }); | |
* Source: https://github.com/wycats/handlebars.js/issues/82 |
This file contains 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 | |
abstract class Resource | |
{ | |
protected static $httpMethods = array("GET", "POST", "HEAD", | |
"PUT", "OPTIONS", "DELETE", "TRACE", "CONNECT"); | |
protected $params; | |
public function __construct(array $params) { | |
$this->params = $params; |
This file contains 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
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /index.php |
This file contains 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
/* | |
* ---------------------------------------------------------------------------- | |
* "THE BEER-WARE LICENSE" (Revision 42): | |
* <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you | |
* can do whatever you want with this stuff. If we meet some day, and you think | |
* this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp | |
* ---------------------------------------------------------------------------- | |
*/ | |
/* | |
* DuinoClient |
This file contains 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
// adicionar no arquivo routes.php | |
Router::connect('/noticia/:id/:title', | |
array('controller' => 'posts', 'action' => 'view'), | |
array('pass' => array('id'), 'title' => '[a-z0-9-#]+','id' => '[0-9]+') | |
); |
This file contains 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
/** | |
* The role map defines how to resolve the user record from your application | |
* to the roles you defined in the roles configuration. | |
*/ | |
$config['map'] = array( | |
'Pessoa' => 'Pessoa/cpf', // username login field | |
'Perfil' => 'Pessoa/perfil_id', // user role field | |
); | |
/** |
This file contains 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 | |
/** | |
* arquivo AppController.php | |
*/ | |
public $components = array( | |
/* outros componentes chamados aqui */ | |
'Acl', | |
'Auth' => array( | |
'authError' => 'O usuário não tem permissão para acessar essa ação', |
This file contains 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
$latlng = "-8.769926868691913 -63.88429307573199"; | |
$radius = 5000; | |
$places = Place::where(DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({latlng})'))"), '<', $radius) | |
->select('offers.*', DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({$latlng})')) AS distance")) | |
->get(); |
This file contains 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 | |
$latlng = "-8.769926868691913 -63.88429307573199"; | |
$radius = 5000; | |
$places = Place::where(DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({latlng})'))"), '<', $radius) | |
->select('offers.*', DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({$latlng})')) AS distance")) | |
->get(); |
This file contains 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 | |
/*...*/ | |
public function selectList() | |
{ | |
$list = $this->select('name', 'id') | |
->orderBy('name') | |
->pluck('name', 'id'); | |
OlderNewer