Skip to content

Instantly share code, notes, and snippets.

View gpassarelli's full-sized avatar

Gabriel Passarelli gpassarelli

View GitHub Profile
@gpassarelli
gpassarelli / alter_git_origin
Last active August 29, 2015 14:21
Alter GIT Origin Source
# View current Origin
cd /path/to/my/repo
git remote -v
git remote rm origin
# Add new Origin
$ cd /path/to/my/repo
$ git remote add origin ssh://[email protected]/username/myproject.git
$ git push -u origin master # to push changes for the first time
@gpassarelli
gpassarelli / gist:52bc73f3fdb7359a43c8
Created February 19, 2015 13:28 — forked from lattejed/ubuntu_basic_setup_do.sh
First 5 Minutes on server
# Note: This is for the Ubunutu 10.04 x64 image available on Digital Ocean
# and may not work for other images / OS versions.
# Warning: This script directy edits some configuration files that may
# render your OS unusable if there is an error. Use at your own risk.
useradd deploy
mkdir /home/deploy
mkdir /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
@gpassarelli
gpassarelli / override.php
Created January 20, 2015 19:40
Laravel Override Config
// Get config loader
$loader = $this->app['config']->getLoader();
// Get environment name
$env = $this->app['config']->getEnvironment();
// Add package namespace with path set base on your requirement
$loader->addNamespace('basset',__DIR__.'/../config/basset');
// Load package override config file
@gpassarelli
gpassarelli / user_role_filter
Created January 20, 2015 19:36
Laravel 4 auth role based page access
Route::filter('role', function()
{
if(Auth::user()->role != 'admin') {
return Redirect::to('home');
}
});
Route::get('protectedPage1', array('before'=>'role', function() {
// do your job
}));
@gpassarelli
gpassarelli / dock_spacer
Created January 20, 2015 19:35
Add spacer to Mac Dock
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
@gpassarelli
gpassarelli / git_stash
Created January 20, 2015 19:35
Ignoring “Your local changes to the following files would be overwritten by merge” on pull
#Git - force a pull to overwrite everything, on every pull
git fetch origin master
git reset --hard FETCH_HEAD
git clean -df
@gpassarelli
gpassarelli / fix_drupal_permission
Created January 20, 2015 19:34
Fix Drupal Files Permitions
cd /path_to_drupal_installation
chown -R www-data:www-data .
find . -type d -exec chmod u=rwx,g=rx,o=rx {} \;
find . -type f -exec chmod u=rw,g=r,o=r {} \;
@gpassarelli
gpassarelli / mysql_dump
Created January 20, 2015 19:32
MySQL DUMP
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
@gpassarelli
gpassarelli / gist:02bfa341918b6df2057b
Created January 20, 2015 19:31
Disable / Enable Mac Dashboard
# Disable
defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock
# Enable
defaults write com.apple.dashboard mcx-disabled -boolean NO
killall Dock
@gpassarelli
gpassarelli / delete_lines_vim
Created January 20, 2015 19:31
Delete all lines from a file with VIM
:1,$d