Chủ Nhật, 27 tháng 3, 2016

Terminal Tips: Enable "path view" in Finder

When you open a Finder window and start browsing to a folder, do you lose track of the path to that folder? If you do, the Terminal command below will enable path view in the Finder -- this means that you will see the directory path to the current folder you are browsing in the title bar, instead of only seeing the name of the current directory.

To make directory paths visible atop Finder windows, open Terminal.app (/Applications/Utilities/) and type the following command:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

Once you run the above command, you will also need to restart the Finder, so you can either type "killall Finder" and hit return, or use the Force Quit option under the Apple menu to relaunch it. The Finder will restart, and you will start seeing the paths to directories in the title bar.
Update: As some have pointed out in the comments below, this Terminal command will only work with Mac OS X Leopard (version 10.5).

Disable certificate verification in PHP SoapClient

$context = stream_context_create(array(
    'ssl' => array(
        // set some SSL/TLS specific options
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
));

$client  = new SoapClient(null, array( 
    'location' => 'https://...',
    'uri' => '...', 
    'stream_context' => $context
));

Chủ Nhật, 20 tháng 3, 2016

Thứ Sáu, 18 tháng 3, 2016

Make Home & End keys behave like Windows on Mac OS X

If, like me, you want Home to send you to the start of the line and not to the top of the document then create a file called DefaultKeyBinding.dict in your ~/Library/KeyBindings folder (might need to create that folder too) with the following contents:
{
    "\UF729"  = moveToBeginningOfParagraph:; // home
    "\UF72B"  = moveToEndOfParagraph:; // end
    "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
    "$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
    "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
    "^\UF72B" = moveToEndOfDocument:; // ctrl-end
    "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
    "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}
This remapping does the following in most Mac apps including Chrome (some apps do their own key handling):
  • Home and End will go to start and end of line
  • ShiftHome and ShiftEnd will select to start and end of line
  • CtrlHome and CtrlEnd will go to start and end of document
  • ShiftCtrlHome and ShiftCtrlEnd will select to start and end of document
Note that you will need to reboot after creating this file for it to take effect.

Source: https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x

Thứ Năm, 3 tháng 3, 2016

Config composer under proxy

set HTTP_PROXY=http://username:password@proxyserver:port && composer install


https://getcomposer.org/doc/00-intro.md

http://www.yiiframework.com/extension/yii2-oauth2-server/#hh1