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
## models.py | |
class Tag(PrintableModel): | |
name = models.CharField( | |
verbose_name=_('Name'), | |
db_index=True, | |
max_length=150, | |
help_text="태그 이름", | |
unique=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
increaseCount = () => { | |
const { count } = this.state; | |
this.setState({ | |
count: count + 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
def myfunc_v1(func, *args): | |
for arg in zip(*args): | |
yield func(*arg) | |
def myfunc_v2(func, *args): | |
return (func(*arg) for arg in zip(*args)) | |
print(list(myfunc_v1(abs, [1, 2, -3]))) | |
print(list(myfunc_v2(abs, [1, 2, -3]))) |
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 myfunc(func, *args): | |
return [func(*arg)for arg in zip(*args)] | |
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 myfunc(func, *args): | |
res = [] | |
for args in zip(*args): | |
res.append(func(*args)) | |
return res | |
myfunc(abs, [-1, 2, 3]) | |
>> [1, 2, 3] | |
myfunc(abc, [-1, -2, -3] |
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 youreducer(func, seq): | |
tally = seq[0] | |
for next in seq[1:]: | |
tally = func(tally, next) | |
return tally | |
def add(x, y): | |
return 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
def youreducer(func, seq): | |
tally = seq[0] | |
for next in seq[1:]: | |
tally = func(tally, next) | |
return tally | |
def add(x, y): | |
return 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
import operator, functools | |
functools.reduce(operator.add, [1, 2, 3, 4, 5]) | |
>> 15 | |
functools.reduce((lambda x, y: x + y), [1, 2, 3, 4, 5]) | |
>> 120 |
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 youreducer(func, seq): | |
tally = seq[0] | |
for next in seq[1:]: | |
tally = func(tally, next) | |
return tally | |
def add(x, y): | |
return 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
docker service create \ | |
--name=api \ | |
--replicas=4 \ | |
--detach=true \ | |
--network={YOUR NET WORK} \ | |
--publish 80:80 \ | |
--publish 443:80 \ | |
--with-registry-auth \ | |
--label com.docker.aws.lb.arn=arn:aws:acm:ap-no{YOUR: AWS : ARN ! ! !} \ |