Skip to content

Instantly share code, notes, and snippets.

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

Bernardo Vieira da Silva BernardoSilva

🏠
Working from home
View GitHub Profile
@BernardoSilva
BernardoSilva / how_to_remove_vagrant_password_prompt
Last active August 29, 2015 14:08
How to remove vagrant up password prompt
# This is working for vagrant 1.6.x
# If you have any problems, add a comment.
$ sudo visudo
# Paste this and save.
# let vagrant set up NFS shares without password prompt
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
@BernardoSilva
BernardoSilva / how_to_use_facebook_symfony2
Last active August 29, 2015 14:08
Facebook SKD 4.0 example on Symfony 2.5
###PHP requirements to be able to use php SDK
- php-mbstring
In Centos you can install this php-module like this:
```bash
$ yum install php-mbstring
```
###Symfony changes required:
In your config.yml need to change the session handler
@BernardoSilva
BernardoSilva / Package Control.sublime-settings
Last active April 25, 2018 09:03
Sublime Text Best extensions for web developer
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"A File Icon",
"Boxy Theme",
"Boxy Theme Addon - Font Face",
@BernardoSilva
BernardoSilva / .bash_profile_for_mac
Last active August 29, 2015 14:06
Mac OSX Developper shortcuts
# Config for MAMP
export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH
# Show hidden files
alias showFiles="defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app"
# Hide hidden files
alias hideFiles="defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app"
# Git
alias gs="git status"
@BernardoSilva
BernardoSilva / mongod
Created July 24, 2014 15:25
Service to start mongodb daemon
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@BernardoSilva
BernardoSilva / install_mongoDb
Last active August 29, 2015 14:04
Install specific version of MongoDb on Ubuntu
First you have to download the 32bit or 64bit Linux binaries from here and unzip the contents to /usr/local.
# cd /tmp
# curl -O http://downloads.mongodb.org/linux/mongodb-linux-i686-2.4.9.tgz
# sudo tar -zxf /tmp/mongodb-linux-i686-2.4.9.tgz -C /usr/local
Then you need to configure some symbolic links.
@BernardoSilva
BernardoSilva / .htaccess
Created March 13, 2014 21:08
this is a way to make zf2 work on a shared hosting
#make ZF2 work on shared hosting using this htaccess
#SetEnv ZF2_PATH /home/username/zf2lib
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
@BernardoSilva
BernardoSilva / standard_php_autoloader
Created March 2, 2014 19:21
example os a standard php autoloader following the PSR-0
<?php
function autoload($className)
{
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strrpos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
@BernardoSilva
BernardoSilva / JS_subClass_example.js
Created September 11, 2013 23:02
example of javascript class definition and Inheritance
// JavaScript Class Definition and Inheritance
function BaseClass() {
//BaseClass constructor code goes here
}
BaseClass.prototype.getName = function() {
return "BaseClass";
}
function SubClass() {
@BernardoSilva
BernardoSilva / set_mamp_php.sh
Created September 5, 2013 16:25
These are the steps to change between the PHP that comes with OSX installation for the MAMP php version you want to run by default when you write php on command line
#this is a way to change the default php to MAMP php version you want
#if you do `which php` you eill see: /usr/bin/php that is the php that comes with OSX installation
which php
#do this to export the path to you .profile ou .bash_profile
export PATH=/Applications/MAMP/bin/php/php5.4.4/bin:$PATH
#then run this command to update the path
source ~/.bash_profile