Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working from home...

Massimiliano Arione garak

:octocat:
Working from home...
View GitHub Profile
View gist:549660
<?php
/**
* healthstate actions.
*
* @package ordinativi
* @subpackage healthstate
* @author KEY5
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
View gist:595620
<?php
class frontendConfiguration extends sfApplicationConfiguration
{
protected $requestFormat = null;
public function configure()
{
$this->dispatcher->connect('request.filter_parameters', array($this, 'filterRequestParameters'));
View actions.class.php
<?php
class itemActions extends sfActions
{
/**
* @param sfRequest $request
*/
public function executeIndex(sfWebRequest $request)
{
$this->form = new ItemForm();
View schema_doctrine.yml
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 }
View schema_propel.yml
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 }
View model_doctrine.php
<?php
// lib/model/doctrine/ItemTable.php
class ItemTable extends Doctrine_Table
{
/**
* @param array $values
* @param integer $limit
* @return Doctrine_Collection
View model_propel.php
<?php
// lib/model/ItemQuery.php
class ItemQuery extends BaseItemQuery
{
/**
* @param array $values
* @param integer $limit
* @return PropelCollection
View locator.js
$().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;
@garak
garak / strtotime.php
Created May 31, 2011
never use '+1 month' and '-1 month' in strtotime. It's just bugged
View strtotime.php
<?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";
View gist:1583690
/**
* @Route("/search/prova")
* @Template()
* @return array
*/
public function provaAction()
{
$form = $this->createFormBuilder()
->add('type', 'choice', array('required' => false, 'choices' => array(
'' => '',