Skip to content

Instantly share code, notes, and snippets.

View garak's full-sized avatar
:octocat:
Working from home...

Massimiliano Arione garak

:octocat:
Working from home...
View GitHub Profile
/**
* @Route("/search/prova")
* @Template()
* @return array
*/
public function provaAction()
{
$form = $this->createFormBuilder()
->add('type', 'choice', array('required' => false, 'choices' => array(
'' => '',
@garak
garak / strtotime.php
Created May 31, 2011 07:45
never use '+1 month' and '-1 month' in strtotime. It's just bugged
<?php
// tried this today, 31 May 2011
echo "\n";
echo date('Y-m-d', strtotime('first day of next month')); // correct
echo "\n";
echo date('Y-m-d', strtotime('+1 month')); // wrong! output is 2011-07-01
echo "\n";
$().ready(function() {
// search address and get latitude/longitude
var searchLocations = function(e) {
var $form = $(this);
var address = $('input#address').val();
var geocoder = new google.maps.Geocoder();
geocoder.geocode({address: address}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
var center = results[0].geometry.location;
<?php
// lib/model/ItemQuery.php
class ItemQuery extends BaseItemQuery
{
/**
* @param array $values
* @param integer $limit
* @return PropelCollection
<?php
// lib/model/doctrine/ItemTable.php
class ItemTable extends Doctrine_Table
{
/**
* @param array $values
* @param integer $limit
* @return Doctrine_Collection
classes:
Item:
columns:
id: ~
name: { type: varchar, required: true }
address: { type: varchar, required: true }
city: { type: varchar, required: true }
latitude: { type: decimal, scale: 6, size: 10, required: true }
longitude: { type: decimal, scale: 6, size: 10, required: true }
Item:
columns:
name: { type: string(255), notnull: true }
address: { type: string(255), notnull: true }
city: { type: string(255), notnull: true }
latitude: { type: decimal, scale: 6, size: 10, notnull: true }
longitude: { type: decimal, scale: 6, size: 10, notnull: true }
<?php
class itemActions extends sfActions
{
/**
* @param sfRequest $request
*/
public function executeIndex(sfWebRequest $request)
{
$this->form = new ItemForm();
@garak
garak / gist:595620
Created September 24, 2010 16:14 — forked from anonymous/gist:595592
<?php
class frontendConfiguration extends sfApplicationConfiguration
{
protected $requestFormat = null;
public function configure()
{
$this->dispatcher->connect('request.filter_parameters', array($this, 'filterRequestParameters'));
<?php
/**
* healthstate actions.
*
* @package ordinativi
* @subpackage healthstate
* @author KEY5
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $