Skip to content

Instantly share code, notes, and snippets.

View leopard627's full-sized avatar

Leopard627 leopard627

  • South Korea
  • 13:18 (UTC +09:00)
View GitHub Profile
## models.py
class Tag(PrintableModel):
name = models.CharField(
verbose_name=_('Name'),
db_index=True,
max_length=150,
help_text="태그 이름",
unique=True)
increaseCount = () => {
const { count } = this.state;
this.setState({
count: count + 1,
});
};
@leopard627
leopard627 / map3.py
Last active February 13, 2020 05:15
map3.py
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])))
def myfunc(func, *args):
return [func(*arg)for arg in zip(*args)]
@leopard627
leopard627 / map1.py
Created February 13, 2020 05:05
pure python map v1
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]
@leopard627
leopard627 / your_reducer.py
Created February 4, 2020 15:50
your_reducer.py
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
@leopard627
leopard627 / your_reducer.py
Created February 4, 2020 15:50
your_reducer.py
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
@leopard627
leopard627 / python_reducer.py
Created February 4, 2020 15:41
learning_python example
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
@leopard627
leopard627 / your_reducer.py
Last active February 4, 2020 15:50
learning_python_example
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
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 ! ! !} \