This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The purpose of this file is to create a complete binding setup so that Windows users can | |
| # port to Mac without having to re-learn every possible shortcut | |
| # First lets start with the all system bindings | |
| # Karabiner-Elements bindings | |
| # download software at "https://karabiner-elements.pqrs.org/" | |
| # Bindings in file `karabiner.json` | |
| # VS Code Bindings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void CellSelectedHandler<T>(CellSelectEventArgs<T> args, SfGrid<T> grid) | |
| { | |
| if (args.IsCtrlPressed) | |
| { | |
| System.Reflection.FieldInfo grid = args.GetType().GetField("Parent", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.GetField | BindingFlags.Public); | |
| var col = grid.FieldType.GetProperty("Columns"); | |
| var wrapped = ObjectAccessor.Create(col); | |
| var argsFM = ObjectAccessor.Create(args); | |
| var gridFM = ObjectAccessor.Create(grid); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get all collection size: | |
| collectionNames.forEach(function (n) { stats.push(db[n].stats()); }); | |
| var byteToMB = 1024*1024; | |
| for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size']/byteToMB + "(MB) (" + stats[c]['storageSize']/byteToMB + ") (MB)"); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Log commits on terminal: | |
| git config --global alias.tree log --pretty="%C(Yellow)%h %C(reset)%ad (%C(Green)%cr%C(reset))%x09 %C(Cyan)%an: %C(reset)%s" --date=short --graph --abbrev-commit | |
| Log branch commits: | |
| git config --global alias.branchtree log --pretty="%C(Yellow)%h %C(reset)%ad (%C(Green)%cr%C(reset))%x09 %C(Cyan)%an: %C(reset)%s" --date=short --graph --abbrev-commit --first-parent --no-merges |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import timeit | |
| from datetime import datetime | |
| if __name__ == '__main__': | |
| def test_get(): | |
| x = {'x':'123'} | |
| return x.get('x') | |
| def test_dict(): | |
| y = {'y':'123'} | |
| return y['y'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def mask_middle(text): | |
| text = str(text) | |
| if len(text) > 2: | |
| return text[0] + "*" * (len(text) - 2) + text[len(text) - 1] | |
| return "*" * len(text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ git config --global --replace-all credential.interactive false | |
| $ git config --global --replace-all credential.modalPrompt false | |
| $ git config --edit --system | |
| # remove line | |
| helper = manager | |
| # To disable openssh password prompt, add these 2 lines | |
| [core] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generates request data payload to be sent as 'form-data' | |
| REQUEST_FORM_DATA_BOUNDARY = "REQUEST_FORM_DATA_BOUNDARY" | |
| FORM_DATA_STARTING_PAYLOAD = '--{0}\r\nContent-Disposition: form-data; name=\\"'.format(REQUEST_FORM_DATA_BOUNDARY) | |
| FORM_DATA_MIDDLE_PAYLOAD = '\"\r\n\r\n' | |
| FORM_DATA_ENDING_PAYLOAD = '--{0}--'.format(REQUEST_FORM_DATA_BOUNDARY) | |
| REQUEST_CUSTOM_HEADER = { | |
| 'content-type': "multipart/form-data; boundary={}".format(REQUEST_FORM_DATA_BOUNDARY), | |
| 'Content-Type': "", | |
| 'cache-control': "no-cache" |