Sử dụng các plugin tiện ích cho Sublime Text 3

SideBar Enhancements

Cho phép mở rộng các chức năng cho thanh sidebar của Sublime Text. Từ đó chúng ta sẽ có thêm nhiều thao tác hơn đối với file và thư mục trong thanh sidebar so với mặc định.

sublime-text-3-sidebar-enhancement-after

DocBlockr

Hỗ trợ bộ docblockr trong tập tin php, bạn chỉ cần gõ /** và tab nó sẽ tạo ra vùng khai báo, các khai báo docblockr trong tập tin php đều hỗ trợ đầy đủ, sử dụng như Snippets nhé.

docblockr

Sublime CodeIntel

Đây là plugin giúp bạn tiết kiệm khá nhiều thời gian. Nó có tính năng cung cấp những gợi ý liên quan đến hàm, biến, đối tượng,.. Nó cũng gợi ý các phương thức và thông số có sẵn trong class, đối tượng..

SublimeCodeIntel

Sublime Alignment

Căn lề đều tự động cho code.

Cú pháp:  Ctrl + Alt + A

BufferScroll

Một plugin mà nó có thể nhớ và phục hồi vị trí của con trỏ và vị trí đã di chuyển tới, cũng như các lựa chọn, phần gấp, đánh giấu các trạng thái.

Xdebug Client

Giúp dễ dàng debug ứng dụng PHP của mình.

VCS Gutter

Giúp hỗ trợ bạn trong khi làm việc với git. Nó sẽ cập nhật thông tin và trạng thái tại real-time (thời gian thực) của một tập tin. Nhờ đó bạn nhanh chóng biết được tập tin nào đã được thêm, xoá, hoặc sửa.

Sublime Linter

Plugin này sẽ giúp bạn biết ngay khi bạn gõ, rằng có thể bạn đã làm một điều gì đó sai, ví dụ, mở ngoặc mà quên đóng, quên dấu ; ở cuối dòng lệnh,…

Kết luận

Plugin trong sublime text cũng chỉ là công cụ làm việc… nhưng nếu biết cách sử dụng chúng sẽ giúp công việc của chúng ta nhanh hơn và đạt năng suất tốt hơn.

 

Nguồn: blogit.vn

Sử dụng plugin Emmet trong Sublime Text 3 để code nhanh

Emmet là gì?

Emmet là một plugin giúp code nhanh và tiện lợi hơn cho các trình soạn thảo code.

Cài đặt Emmet

Đầu tiên bạn bấm Ctrl + Shift + P, rồi gõ Install Package, gõ tiếp Emmet và nhấn Enter để cài đặt plugin này cho Sublime Text nhé.

Viết mã HTML

Cú pháp: Gõ lệnh rồi nhấn phím Tab.

Gõ <ul> rồi nhấn Tab thì kết quả sẽ như sau:

basic-ul-element

Gõ div.class rồi nhấn Tab:

div-class

Thành phần con

Cấu trúc cũng giống như cấu trúc CSS, emmet sử dụng ký hiệu > để chỉ ra thành phần con.

Ví dụ:

emmet-child-elements

Thành phần cùng cấp

Ví dụ:

sibling-elements

Cấp ID và Class cho phần tử HTML

Cũng giống như cú pháp CSS, emmet dùng ký hiệu # để chỉ ID và ký hiệu . để chỉ Class

Ví dụ:

id-and-class

Như ví dụ trên, khi không chỉ ra phần tử HTML thì emmet sẽ hiểu là thẻ div

Khi bạn muốn chỉ ra phần tử cụ thể thì khai báo phần tử đó trước ký hiệu

Ví dụ:

specific-elements

Chỉ ra nhiều Class trong một phần tử:

Ví dụ:

multiple-classes

Cấp phát thuộc tính

Ví dụ:

attribute

Kết hợp nhiều cú pháp

Lặp lại phần tử nhiều lần dùng ký hiệu *

Ví dụ:

multiplication

Khai báo tập tin HTML

Ví dụ:

html5-structure

Lorem Ipsum

Số bao nhiêu sẽ ra bấy nhiêu chữ

Ví dụ:

generate-lipsum

Sử dụng Emmet trong CSS

Cũng tương tự HTML, Emmet giúp chúng ta viết cú pháp CSS nhanh hơn.

Ví dụ:

emmet-css

css-visibility

Kết luận

Như vậy là các bạn đã nắm được cách sử dụng plugin rất hữu dụng trong Sublime Text là Emmet rồi nhé. Tuy chỉ giới thiệu sơ qua các tính năng và cú pháp nhưng nhiêu đó chắc cũng đủ để giúp các bạn cải thiện được tốc độ code của mình rồi. Để nắm chi tiết hơn thì các bạn có thể vào trang chủ của Emmet sẽ có đầy đủ thông tin hơn.

Nguồn: blogit.vn

 

Các phím tắt thường dùng trong Sublime Text 3

Ctrl + P : xuất hiện một bảng chọn file trong toàn bộ các file của folder project.

Ctrl + G : xuất hiện một bảng nhập số dòng mình muốn tới.

Ctrl + R : xuất hiện bảng chọn hàm trong file để di chuyển đến đó.

Ctrl + Pageup­/Pa­gedown : di chuyển qua lại giữa các tập tin

Ctrl + Delete/Backspace: xóa một cụm từ trước hoặc sau vị trí con trỏ

Ctrl + KK: xóa từ vị trí con trỏ tới cuối dòng

Ctrl + T : hoán đổi 2 ký tự đứng kế nhau

Ctrl + K + U : chuyển đổi toàn bộ chuỗi từ thường sang HOA

Ctrl + K + L : chuyển đổi toàn bộ chuỗi từ HOA sang thường

Ctrl + Shift + D: sao chép dòng hiện tại thành một dòng mới

Ctrl + Shift + K : xóa một dòng

Ctrl + Shift + Up,Down: di chuyển một dòng lên trên hoặc xuống dưới

Ctrl + Enter: thêm một dòng phía sau

Ctrl + Shift + Enter: thêm một dòng phía trước

Ctrl+K+B: ẩn/hiện side bar

Ctrl+/: comment

Ctrl+Shift+/: comment dạng block

Ctrl+L: select 1 dòng

Ctrl+Shift+K: xóa 1 dòng

Ctrl+]: indent

Ctrl+[: bỏ indent

Ctrl+Shift+D: nhân đôi dòng

Ctrl+J: nối dòng với dòng tiếp theo

Ctrl+Shift+[: đóng 1 đoạn code

Ctrl+Shift+]: mở 1 đoạn code

Ctrl+F: tìm kiếm

Ctrl+H: tìm kiếm và thay thế

Ctrl+Shift+N: mở cửa sổ mới

Ctrl+N: mở tab mới

Alt+: chuyển tab (ví dụ Alt+3)

Share file qua mạng LAN đơn giản

Phù hợp với các bạn biết chút về máy tính nhé 😉

Điều kiện: Máy đã cài python.

1. Mở CMD / Termiral vào thự mục cần share file, chạy lệnh:

python -m SimpleHTTPServer 8000

2. Xem ip của máy cần share.

Win:

ipconfig

Mac/ Ubuntu

ifconfig

3. Sau khi biết ip của máy share rồi thì vào máy cần tải file share.

4. Mở trình duyệt gõ:

192.168.x.x:8000

Lưu ý: 192.168.x.x là ip của máy share file lấy từ bước 2

5. Tải file

How do I view and control cookies in my web browser?

Chrome

  1. From the Chrome menu in the top right corner of the browser, select Settings.
  2. At the bottom of the page, click Show advanced settings….
  3. Under Privacy, select Content settings….
    • To manage cookie settings, check or uncheck the options under “Cookies”.
    • To view or remove individual cookies, click All cookies and site data… and hover the mouse over the entry. Select the X that appears next to the cookie to remove it.
    • To delete all cookies, click All cookies and site data… and select Remove all.

Firefox

  1. From the Tools menu, select Options.If the menu bar is hidden, press Alt to make it visible.
  2. At the top of the window that appears, click Privacy.
    • To manage cookie settings, from the drop-down menu under “History”, select Use custom settings for history. Enable or disable the settings by checking or unchecking the boxes next to each setting:
      • To allow sites to set cookies on your computer, select Accept cookies from sites. To specify which sites are always or never allowed to use cookies, click Exceptions.
      • To accept third-party cookies, check Accept third-party cookies. In the “Keep until:” drop-down menu, select the time period you wish to keep cookies on your computer.
      • To specify how the browser should clear the private data it stores, check Clear history when Firefox closes. Click Settings…. Check the items to be cleared when you close Firefox.
    • To view or remove individual cookies, click remove individual cookies.
    • To remove all cookies, from the History menu, select clear your recent history. Click the arrow next to “Details” to expand the menu, check the items you want to clear, and then click Clear Now.

Internet Explorer

Note:
As of January 12, 2016, Microsoft has ended support for Internet Explorer versions prior to version 11, unless you are running Windows Vista SP2 or certain versions of Windows Server; for a complete list of exceptions, see Microsoft Support Lifecycle. UITS strongly recommends that you upgrade to a new operating system if your current system does not support Internet Explorer 11 and is not on Microsoft’s list of exceptions.
  1. From the Tools menu, or the Tools drop-down at the upper right, select Internet Options.If the menu bar is hidden, press Alt to make it visible.
    • To manage cookie settings, select the Privacy tab and click Advanced. To override the automatic cookie settings, click Override automatic cookie handling and then make your selections using the radio buttons.
    • To view or remove individual cookies, select the General tab. Under “Browsing history”, clickSettings. Select either View objects or View files.
    • To delete all cookies, under “Browsing history”, click Delete…. Check Cookies and then clickDelete.

This content is adapted from Microsoft Help and Support article 278835.

 

Safari

Note: To determine the version of Safari you’re using, from the Safari menu, select About Safari.

Safari 5.1 and later

  1. In Safari, from the Safari menu, select Preferences….
  2. In the Safari preferences window, click Privacy.
    • To manage cookie settings, next to “Block cookies”, select From third parties and advertisers,Always, or Never.
    • To view or remove individual cookies, click Details…. Select the cookie to delete and click Remove.
    • To delete all cookies, select Remove All Website Data… In the window that appears, select Remove Now.

Safari 5.0.x and earlier

  1. In Safari, from the Safari menu, select Preferences….
  2. In the Safari preferences window, click Security.
    • To manage cookie settings, next to “Accept Cookies:”, select Always or Only from sites you navigate to. To disable cookies, select Never.
    • To view and delete individual cookies, click Show Cookies. In the sheet that drops down, you can browse the list of cookies on your computer.
    • To delete all cookies, click Show Cookies. In the window that appears, select Remove All.

 

Ref: https://kb.iu.edu/d/ajfi

[Git] Xóa branch (nhánh) local và remote (server)

If you want to delete a branch, first checkout to the branch other than the branch to be deleted.

Ví dụ: Nhánh bạn cần xóa là developer_old

(Nếu bạn muốn xóa một nhánh, đầu tiên cần checkout sang nhánh khác nhánh cần xóa)

Tổng quát

git checkout other_than_branch_to_be_deleted

Cụ thể:

git checkout master

Deleting the local branch: (Cú pháp xóa nhánh ở local: (máy mình đang code))

Tổng quát (xóa nhánh ở local):

git branch -D branch_to_be_deleted

Cụ thể:

git branch -D developer_old

Deleting the remote branch: (Cú pháp xóa nhánh ở server, nơi mình sẽ remote lên để xóa)

Tổng quát (xóa nhánh ở server)

git push origin --delete branch_to_be_deleted

Cụ thể:

git push origin --delete developer_old

Xóa tất các nhánh ở local: (Thêm)

git branch | grep -v "master" | xargs git branch -D

 

Note: The -d option is an alias for --delete, which only deletes the branch if it has already been fully merged in its upstream branch. You could also use -D, which is an alias for --delete --force, which deletes the branch “irrespective of its merged status.” [Source: man git-branch]

-d là viết ngắn gọn của –delete và nó chỉ xóa khi nhánh đó đã được merged vào từ nhánh gốc nó base ra. -D là –delete và –force => xóa hết ko cần quan tâm

Ref: http://stackoverflow.com/questions/2003505/how-to-delete-a-git-branch-both-locally-and-remotely

[GIT]Cách giải quyết untrack file trong git / solved git untrack file

Xóa các file untrack nếu biết nó không cần thiết trong dự án

To know what will be deleted before actually deleting: (Liệt kê các file trước khi xóa )

git clean -d -n

It will output something like: (Các file sẽ xóa sẽ được liệt kê giống bên dưới )

Would remove sample.txt

To delete everything listed in the output of the previous command: (Xóa các file đã liệt kê từ câu lệnh trước đó (-d -n) )

git clean -d -f

It will output something like:

Removing sample.txt

Ref: http://stackoverflow.com/questions/61212/how-to-remove-local-untracked-files-from-the-current-git-branch