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
@Injectable() | |
export class AuthzService { | |
constructor( | |
@InjectRepository(UserRepository) | |
private userRepository: UserRepository, | |
) {} | |
async findAllPermissionsOfUser(user: User): Promise<Permission[]> { | |
return await this.userRepository.findAllPermissions(user); | |
} | |
} |
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
$ yarn add @casl/ability | |
$ nest g module authz |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
//terminal | |
{ | |
"key": "cmd+k", | |
"command": "workbench.action.focusActiveEditorGroup", | |
"when": "terminalFocus" | |
}, | |
{ | |
"key": "cmd+j", |
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
<template> | |
<div class="book"> | |
<slot name="title" | |
:bookTitle="bookTitle" | |
/> | |
</div> | |
</template> | |
<script> | |
export default { |
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
function uppercase( target: any, name: string, desc: PropertyDescriptor ) { | |
return { | |
get: function (): string { | |
return desc.get?.call( this ).toUpperCase(); | |
}, | |
set: function ( name: string ) { | |
desc.set?.call( this, name.split(' ') ); | |
} | |
}; | |
} |
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: | |
def updateBoard(self, board: List[List[str]], click: List[int]) -> List[List[str]]: | |
y = click[0] | |
x = click[1] | |
if board[y][x] == 'M': | |
board[y][x] = 'X' | |
return board | |
adjacent_mines = 0 |
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: | |
def isSubsequence(self, s: str, t: str) -> bool: | |
for c in s: | |
i = t.find(c) | |
if i == -1: | |
return False | |
else: | |
t = t[i+1:] | |
return True |
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: | |
def romanToInt(self, s: str) -> int: | |
cv_map = { | |
'I': 1, | |
'V': 5, | |
'X': 10, | |
'L': 50, | |
'C': 100, | |
'D': 500, | |
'M': 1000 |
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
* text=auto eol=lf | |
*.{cmd,[cC][mM][dD]} text eol=crlf | |
*.{bat,[bB][aA][tT]} text eol=crlf |
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
#!/bin/sh | |
git filter-branch --env-filter ' | |
OLD_EMAIL="[email protected]" | |
CORRECT_NAME="Nguyen Tri Minh" | |
CORRECT_EMAIL="[email protected]" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then |