Skip to content

Instantly share code, notes, and snippets.

View LuisRBarreras's full-sized avatar

Luis R Barreras LuisRBarreras

View GitHub Profile
@LuisRBarreras
LuisRBarreras / Sysmfony2 customRepository
Created December 4, 2013 22:53
Symfony2 Custom Repository Class Example
namespace Core\MainBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Core\MainBundle\Entity\user;
class userRepository extends EntityRepository
{
public function findUserByEmail($email, $password)
{
$query = $this->getEntityManager()
@LuisRBarreras
LuisRBarreras / gist:8153072
Created December 27, 2013 21:45
Apache2 virtual host
<VirtualHost *:80>
ServerName local.test-nearsoft
DocumentRoot /home/lbarreras/work/documentationTest/nearsoft-php-seleniumclient/web
DirectoryIndex index.php
ErrorLog /var/log/apache2/test-php-selenium-documentation-error.log
CustomLog /var/log/apache2/test-php-selenium-documentationaccess.log combined
<Directory "/home/lbarreras/work/documentationTest/nearsoft-php-seleniumclient">
AllowOverride All
Allow from All
</Directory>
@LuisRBarreras
LuisRBarreras / js module.js
Last active January 2, 2016 18:59
javascript module patter
//The module pattern
var feature = (function() {
var sidewaysTriangle = function(n) {
for(var i=0; i<n; i++)
{
var output = "";
for(var j=0; j<=i; j++)
{
output+="*";
var feature = (function () {
//code goes here
})();
@LuisRBarreras
LuisRBarreras / Contact
Created February 18, 2014 15:53
Example Dependency Inversion Principle
interface Mailer {
public void send();
}
class Gmail implements Mailer {
public void send() {
//....send mail
}
}
public class User {
private MessageManager contactManager;
private MessageManager messageManager;
public construct(contactManager, messageManager)
this.contactManager = contactManager;
this.messageManager = messageManager;
}
@LuisRBarreras
LuisRBarreras / simulated_queue.java
Last active August 29, 2015 13:57
Making a queue using two stack
public void function queue(Node node) {
stackToStore.push(node);
}
public Node function dequeue() {
if(stackToRetrive.top==null) {
while(stackToStore.top!=null) {
Node tmp = stackToStore.pop();
stackToRetrive.push(tmp);
}
@LuisRBarreras
LuisRBarreras / git filemode
Created March 21, 2014 18:20
To ignore filemode change on git
git config core.filemode false
@LuisRBarreras
LuisRBarreras / zend_framework_2 actvite display error
Last active August 29, 2015 13:59
Add these code on module.php
ini_set('display_startup_errors',true);
ini_set('display_errors',true);
return array();
@LuisRBarreras
LuisRBarreras / git confing cached password
Created May 5, 2014 23:40
Set the cache to timeout after 1 hours(default is 15 minutes)
git config --global credential.helper 'cache --timeout=3600'