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
# search with and/or condition | |
df4 = df3.query('(From=="AHH" & To=="BBH") | (From=="BBH" & To=="AHH")') | |
OR | |
data.loc[(data["Gender"]=="Female") & (data["Education"]=="Not Graduate") & (data["Loan_Status"]=="Y"), ["Gender","Education","Loan_Status"]] | |
# Rows to columns | |
df = df.stack().reset_index().rename(columns={'level_0':'From','level_1':'To', 0:'Hours'}) | |
# Join two df like sql join | |
df1 = df1.merge(record_df, on='location_code', how='outer', suffixes=('_x', '_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
======= Interviews ========== | |
# Duration July - August 2021 | |
## Django: | |
* Flow of Django | |
* Django Middlewares | |
* Django request/response cycle | |
* API security(auth based token and others) | |
* Avoid deadloak in django ( F() ) |
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 clone from specific branch | |
git clone -b my-branch [email protected]:user/myproject.git | |
# Before pushed code need to run given command.. | |
git stash clear; git stash; git pull; git stash apply; | |
git commit files | |
git add . | |
git commit -m "udpate" | |
git push |
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
$.validator.addMethod("emailFormat", | |
function (value, element) { | |
// return !/[0-9]*/.test(value); | |
return this.optional(element) || /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(value); | |
}, | |
//'Please enter a valid email address.' | |
"Please enter a valid email" | |
); | |
$.validator.addMethod("blankSpace", | |
function (value, element) { |
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
from django.http import HttpResponseRedirect | |
def authors_only(function): | |
def wrap(request, *args, **kwargs): | |
profile = request.user.get_profile() | |
if profile.usertype == 'Author': | |
return function(request, *args, **kwargs) | |
else: | |
return HttpResponseRedirect('/') |
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
# It ignore whole certain directory | |
env/ | |
instance/* | |
# It ignore all files in certain directory but not given directory | |
!instance/.gitkeep | |
!migrations/__init__.py | |
# It ignore all files which has certain extension | |
*.pyc |
NewerOlder