Using AutoHotKey and Ditto with PHP

I’m a purist I suppose. I write PHP, Javascript, CSS, and HTML in Notepad++. I don’t use an IDE (such as NetBeans), but I do have some shortcuts to make things go faster for me. The first one, Ditto, is a clipboard program that remembers the last 10 things put into the clipboard. This means you don’t have to worry about losing that copy/paste because it was overwritten. It’s simple, open, and a no-brainer addition. For those on OSX, Jumpcut is a great option.

The second one is AutoHotKey, which is crazy powerful, but for this example, I’m using its simple text replacement features. For instance, when I type qwhi, it is replaced with this:

while ($row = mysqli_fetch_assoc($result)){
 
}mysqli_free_result($result);

You can imagine how handy this can be. Below are some of the shortcodes I use in my AutoHotKey file. Enjoy.

; ### MySQLi Shortcuts ### 
:*:qms::$result = mysqli_query($mysqli,$query) or die(mysqli_error($mysqli)){;}
:*:qwhi::while ($row = mysqli_fetch_assoc($result)){{}`n`n{}}mysqli_free_result($result);{Left 29}{up 1}`t
:*:qnum::if (mysqli_num_rows($result){{}`n`n{}}{up 1}`t
:*:qres::mysqli_result($result);
 
; ### PHP Shortcuts ### 
:*:pphp::<?php  ?>{left 3}
:*:pswi::switch () {{}`n`n`n`n`n`n{}}{up 1}`t{up 4}`tcase 'string':{down 3}`tdefault:{up 1}`t`tbreak{;}{up 1}`t`t{up 2}
:*:pfor::for ($x=0;$x<=10;$x{+}{+}){{}`n`n{}}{up 1}`t
:*:pqu::$query = "";{left 2}
:*:ppass::password_hash(,PASSWORD_BCRYPT);{left 18}
 
; ### MySQL Query Shortcuts ### 
:*:qins::INSERT INTO  (col) VALUES ('val'){left 21}
:*:qupd::UPDATE  SET = WHERE{left 12}
:*:qups::INSERT INTO  (col) VALUES ('val') ON DUPLICATE KEY UPDATE col=VALUES(col){left 61}
:*:qsel::SELECT * FROM  WHERE{left 6}
:*:qdel::DELETE FROM  WHERE{left 6}
Share and Enjoy:
  • Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • del.icio.us
  • Tumblr
  • PDF

One thought on “Using AutoHotKey and Ditto with PHP

Leave a Reply to Truyen nguoi lon Cancel reply

Your email address will not be published. Required fields are marked *