Skip to content

Instantly share code, notes, and snippets.

View diegograssato's full-sized avatar
🏠
Working from home

Diego Pereira Grassato diegograssato

🏠
Working from home
View GitHub Profile
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace DTUXFixture;
@diegograssato
diegograssato / gist:9485737
Created March 11, 2014 13:37
module.config.yml
router:
routes:
home:
type: Zend\Mvc\Router\Http\Literal
options:
route: /
defaults:
controller: Application\Controller\Index
action: index
application:
@diegograssato
diegograssato / VagrantfileBSD
Last active August 29, 2015 14:02
Vagrantfile - FreeBSD
Vagrantfile
# -*- mode: ruby; -*-
Vagrant.configure("2") do |config|
config.vm.guest = :freebsd
config.vm.box_url = "http://files.wunki.org/freebsd-10.0-amd64-wunki.box"
config.vm.box = "freebsd-10.0-amd64-wunki"
config.vm.network "private_network", ip: "10.0.1.10"
# Use NFS as a shared folder
config.vm.synced_folder ".", "/vagrant", :nfs => true, id: "vagrant-root"
@diegograssato
diegograssato / mongodb
Created June 9, 2014 20:50
Startar o mongodb quando a máquina estiver com pouco espaço em disco
sudo mongod -f /etc/mongodb.conf --smallfiles &
@diegograssato
diegograssato / Busca.js
Last active August 29, 2015 14:02
Exemplo de DBRef
Host.findOne({nome: req.body.host})
.populate('dominio')
.exec(function (err, host) {
console.log(host);
});
<?php
namespace Application\View\Helper;
//use Zend\View\Helper\AbstractHelper;
use Zend\Form\View\Helper\AbstractHelper;
use Zend\Form\Form;
class RenderForm extends AbstractHelper {
<?php
namespace Application\Hydrator;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject;
class DateHydrator extends DoctrineObject {
protected function handleTypeConversions($value, $typeOfField) {
if ($typeOfField == 'date') {
@diegograssato
diegograssato / import.php
Created January 21, 2015 20:33
loadFixture
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\Executor\MongoDBExecutor;
use Doctrine\Common\DataFixtures\Purger\MongoDBPurger
//Grooscript Angular.js TODO example from https://angularjs.org/
//You need next release of grooscript to run it (1.0.1)
class TodoController implements AngularController {
def todos = [
[text:'learn angular', done: true],
[text:'build an angular app', done: false]
]
def addTodo() {
scope.todos << [text: scope.todoText, done: false]
scope.todoText = ''
angular.module('myApp')
.factory('Traits', function() {
return {
apply: function (_class, _trait) {
_.each(_trait, function (method, name) {
_class.prototype[name] = method;
});
}
}
});