This file contains 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
.DS_Store | |
.ipynb_checkpoints | |
__pycache__ | |
.idea | |
.pyc |
This file contains 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
# fetch the changes from the remote | |
git fetch origin | |
# show commit logs of changes | |
git log master..origin/master | |
# show diffs of changes | |
git diff master..origin/master | |
# apply the changes by merge.. |
This file contains 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.db import models | |
class CharNullField(models.CharField): | |
""" | |
Subclass of the CharField that allows empty strings to be stored as NULL. | |
This class is used to set charfield be optional but unique when added. | |
Set blank=True, null=True when declaring the field | |
""" | |
description = "CharField that stores NULL but returns ''." | |
This file contains 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 collections import OrderedDict | |
EMOJI_UNICODE = OrderedDict({ | |
u':1st_place_medal:': u'\U0001F947', | |
u':2nd_place_medal:': u'\U0001F948', | |
u':3rd_place_medal:': u'\U0001F949', | |
u':AB_button_(blood_type):': u'\U0001F18E', | |
u':ATM_sign:': u'\U0001F3E7', | |
u':A_button_(blood_type):': u'\U0001F170', | |
u':Afghanistan:': u'\U0001F1E6\U0001F1EB', |
This file contains 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
🥇 1 | |
🥈 1 | |
🥉 1 | |
🆎 1 | |
🏧 1 | |
🅰 1 | |
🇦🇫 2 | |
🇦🇱 2 | |
🇩🇿 2 | |
🇦🇸 2 |
This file contains 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
var fs = require('fs'); | |
var text = fs.readFileSync('./emoji_length.txt'); | |
var lines = text.toString().split('\n') | |
for (i=0; i < lines.length; i++) { | |
// console.log(lines[i].split(' ')); | |
emoji = lines[i].split(' ')[0]; | |
count = lines[i].split(' ')[1]; | |
// test for not use spread operator |
This file contains 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
""" | |
BMP ranges: | |
0000-007F:C0控制符及基本拉丁文 (C0 Control and Basic Latin) | |
0080-00FF:C1控制符及拉丁文补充-1 (C1 Control and Latin 1 Supplement) | |
0100-017F:拉丁文扩展-A (Latin Extended-A) | |
0180-024F:拉丁文扩展-B (Latin Extended-B) | |
0250-02AF:国际音标扩展 (IPA Extensions) | |
02B0-02FF:空白修饰字母 (Spacing Modifiers) | |
0300-036F:结合用读音符号 (Combining Diacritics Marks) |
This file contains 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
1 | |
! 1 | |
" 1 | |
# 1 | |
$ 1 | |
% 1 | |
& 1 | |
' 1 | |
( 1 | |
) 1 |
This file contains 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
var fs = require('fs'); | |
var text = fs.readFileSync('./unicode_plane.txt'); | |
var lines = text.toString().split('\n') | |
for (i=0; i < lines.length; i++) { | |
// console.log(lines[i].split(' ')); | |
unicode_char = lines[i].split(' ')[0]; | |
count = lines[i].split(' ')[1]; | |
// test for not use spread operator |
This file contains 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 removeDuplicates(self, nums: List[int]) -> int: | |
if len(nums) == 0: return 0 | |
if len(nums) == 1: return 1 | |
# nums = [0,0,1,1,1,2,2,3,3,4] | |
j = 1 # slover pointer, only move when meet unique number | |
for i in range(1, len(nums)): # faster pointer, i will iterate over all element in nums | |
if nums[i] != nums[i-1]: # when nums[i] is a unique number, assign it to nums[j] | |
nums[j] = nums[i] |
OlderNewer