Skip to content

Instantly share code, notes, and snippets.

View rdohms's full-sized avatar
🔧
fixing all the things

Rafael Dohms rdohms

🔧
fixing all the things
View GitHub Profile
in ERB template: <% link_to "Contato", :controller => "nerdtrack", :action => "contato" %>
on regular pages its ok, but on Clearance pages i get this:
- http://0.0.0.0:3000/clearance/nerdtrack/contato
instead of
- http://0.0.0.0:3000/nerdtrack/contato
@rdohms
rdohms / array_read.php
Created March 29, 2011 11:55
Solution to always checking the array elements to avoid PHP notices
<?php
//Original code
$this->setProperty( $data['property'] );
//How it has to be done because array may not contain that value (its optional)
$this->setProperty( isset($data['property'])? $data['property'] : null );
/*
* Question is: Is there a cleaner way of doing this, if so, how?
@rdohms
rdohms / samplemock.php
Created April 11, 2011 18:15
Why does mocking not work when the mocked method is private and called from inside the class?
<?php
class A
{
public function doFirst()
{
return $this->doSecond();
}
private function doSecond()
@rdohms
rdohms / DoctrineExtension.php
Created April 15, 2011 01:15
Storing this Extension in a gist to use it while Silex Extra Extensions repo does not come around
<?php
/*
* This file is part of the Silex framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@rdohms
rdohms / user.php
Created July 21, 2011 22:05
DMS\Filter Example
<?php
namespace App\Entity;
//Import Annotations
use DMS\Filter\Rules as Filter;
class User
{
@rdohms
rdohms / RpcApi.php
Created February 23, 2012 21:18 — forked from chartjes/RpcApi.php
<?php
function validateProducts($storeData) {
// Check to make sure that our valid fields are in there
$requiredFields = array(
'price',
'name',
'description',
'type',
<?php
function validateProducts($products) {
// Check to make sure that our valid fields are in there
$requiredFields = array(
'price',
'name',
'description',
'type',
@rdohms
rdohms / default.vcl
Created October 13, 2012 08:42
Varnish Config
backend default {
.host = "127.0.0.1";
.port = "80";
}
acl purge {
"localhost";
"69.195.222.132";
}
sub vcl_recv {
@rdohms
rdohms / wordpress.vcl
Created October 15, 2012 10:08 — forked from ThijsFeryn/wordpress.vcl
WordPress Varnish VCL
backend default {
.host = "127.0.0.1";
.port = "80";
}
acl purge {
"localhost";
"<external-ip>";
}
sub vcl_recv {
@rdohms
rdohms / MyAbstractType.php
Created December 5, 2012 15:22
Binding Events in Parent Form
<?php
abstract class MyAbstractType extends AbstractType
{
/** CODE */
}