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
| export abstract class Either<L, R> { | |
| left!: L; | |
| right!: R; | |
| static Right = <T>(v: T) => new Right(v); | |
| static Left = <T>(v: T) => new Left(v); | |
| abstract map<T>(f: (a: R) => T): Either<L, T>; | |
| abstract flatMap<T>(f: (a: R) => Either<L, T>): Either<L, T>; | |
| abstract orElse<T>(a: Either<L, T>): Either<L, R>; |
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
| // i tried to add retry button on antd upload list | |
| // but no easy way to do it | |
| // so i hack it in the following way | |
| // the idea is interesting because i am kind of "modifying" React Node children | |
| import produce from "immer" | |
| const itemRender = (originNode: React.ReactElement, file: UploadFile, fileList: UploadFile[]) => { | |
| if(file.status === "error") { | |
| const {prefix} = this.props |
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
| # -*- coding: utf-8 -*- | |
| import codecs | |
| STATE = "IDEL" # INSERT, SEQUENCE | |
| f = open("1.sql", "r") | |
| f_w = codecs.open("test.sql", 'w', 'utf-8') |
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 camel_to_snake_case(name: str) -> str: | |
| # ord('a') == 97 | |
| r = [] | |
| new_group = [name[0].lower()] | |
| for c in name[1:]: | |
| if 97 <= ord(c) <= 122: | |
| new_group.append(c) | |
| else: | |
| r.append("".join(new_group)) | |
| new_group = [c.lower()] |
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
| class Solution(object): | |
| def invertTree(self, root): | |
| """ | |
| :type root: TreeNode | |
| :rtype: TreeNode | |
| """ | |
| if root is None: | |
| return root | |
| if root.left: |
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
| ngrok: https://ngrok.com/ # Introspected tunnels to localhost | |
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
| Redressed: [https://www.google.com/fonts/specimen/Redressed](https://www.google.com/fonts/specimen/Redressed) | |
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
| .yue { | |
| font: 400 18px/1.62 "Georgia", "Xin Gothic", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft YaHei", "SimSun", sans-serif; | |
| color: #333332; | |
| } |
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
| /** | |
| Usage: | |
| app.addRoute("/user/<userid>/", function(){ | |
| console.log("userid:", this.userid); | |
| }).addRoute("/post/<postid>/", function(){ | |
| console.log("postid:", this.postid); | |
| }).addRoute("/post/<postid>/comments", function(){ | |
| console.log("comment of post"); | |
| }) | |
| app.startMain("/user/1/"); // >>> userid: 1 |
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
| [ | |
| { "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} }, | |
| { "keys": ["ctrl+up"], "command": "swap_line_up" }, | |
| { "keys": ["ctrl+down"], "command": "swap_line_down" }, | |
| { "keys": ["ctrl+alt+l"], "command": "beautify" }, | |
| ] |
NewerOlder