Skip to content

Instantly share code, notes, and snippets.

View blackymetal's full-sized avatar

Ariel Patino blackymetal

View GitHub Profile
@blackymetal
blackymetal / gist:1042688
Created June 23, 2011 14:59
Redirecting and passing $this->data
// for example, to reroute to users/delete
// this is in the controller which receives the request.
// this could even be in the AppController
$this->autoRender = false;
$d = new Dispatcher();
$d->dispatch(
array("controller" => "users", "action" => "delete"),
array("data" => $this->data)
@blackymetal
blackymetal / regexp proveedores peru
Created January 24, 2013 03:15
Convierte a SQL
Regexp ^([\w\W]{8})\s{3}([^\n]+[^\s]+)\s+([A-Z\s]{2})\s{10}$
Replace INSERT INTO proveedores(id, nombre, pais_id) VALUE ('$1', '$2', '$3');
AT001825 ELIMPEX A
HK004391 HIMALI ELECTRONICS INTERNATIONAL H
AD000014 CILINDROS Y CROMADOS S.A. AD
AE000010 AL KEDDAH TRADING CO. LLC. AE
AE000029 GEOGAS TRADING S.A. AE
@blackymetal
blackymetal / log_CakePHP
Last active December 16, 2015 06:28
Obtener las consultas a la Bd en CakePHP
$log = $this->Establecimiento->Promocione->getDataSource()->getLog(false, false);
@blackymetal
blackymetal / Creating Aco
Last active February 29, 2016 21:27
Creating new aco and granting permissions from CakePHP's console
./Console/cake acl create aco Usuarios admin_switch
./Console/cake acl create aco Usuarios super_switch
./Console/cake acl grant Group.2 Usuarios/admin_switch
#View AC=
./Console/cake acl view aco Promociones
# Create aro on root
./Console/cake acl create aro / Group.1
@blackymetal
blackymetal / stop tracking remote branch
Created June 14, 2013 13:58
Stop tracking remote branch
git branch -d -r origin/<remote branch name>
@blackymetal
blackymetal / Discard File changes
Created June 27, 2013 14:45
Git Discard file changes
git checkout v1.2.3 -- filename # tag v1.2.3
git checkout stable -- filename # stable branch
git checkout origin/master -- filename # upstream master
git checkout HEAD -- filename # the version from the most recent commit
git checkout HEAD^ -- filename # the version before the most recent commit
@blackymetal
blackymetal / Undo Git changes
Created July 4, 2013 15:02
Undo Git changes
This will unstage all files you might have staged with git add:
git reset
This will revert all local uncommitted changes (should be executed in repo root):
git checkout .
This will remove all local untracked files, so only git tracked files remain:
git clean -fdx
@blackymetal
blackymetal / CLI List all directories Mac Linux Unix
Created July 11, 2013 15:21
CLI List all directories Mac/Linux/Unix
ls -l | awk '/^d/ {print $9}'
@blackymetal
blackymetal / Kanye structured data
Created July 22, 2013 13:46
kanyes's structured data
<meta content="Kanye West" property="og:title" />
<meta content="BLKKK SKKKN HEAD" property="og:description" />
<meta content="http://a4.g.akamai.net/7/1/9499/v1/defjam.download.akamai.com/9499/kanye/assets/fb/BLKKK178.jpg" property="og:image" />
<meta content="http://www.kanyewest.com" property="og:url" />
<meta content="Kanye West" property="og:site_name" />
<meta content="16806373" property="fb:admins" />
<meta content="website" property="og:type" />
<meta content="Spins.FM" name="author" />
@blackymetal
blackymetal / git reset uncommited changes
Created July 22, 2013 16:21
git reset uncommited changes
# Revert changes to modified files.
git reset --hard
# Remove all untracked files and directories.
git clean -fd