Skip to content

Instantly share code, notes, and snippets.

View le2sky's full-sized avatar

Haneul Lee le2sky

  • Anyang, Korea
View GitHub Profile
@le2sky
le2sky / curry3-delivery.ts
Created May 29, 2022 02:48
curry3-delivery
//가변적인 인자에 대한 커리 함수를 만드는 것은 까다롭기 때문에 3개 인자로 고정된 커리 함수로 변환하는 함수
const curry3 =
<A, B, C, D>(f: (a: A, b: B, c: C) => D) =>
(a: A) =>
(b: B) =>
(c: C) =>
f(a, b, c);
const curriedDelivery = curry3(delivery);
//가변적인 인자에 대한 커리 함수를 만드는 것은 까다롭기 때문에 3개 인자로 고정된 커리 함수로 변환하는 함수
const curry3 =
<A, B, C, D>(f: (a: A, b: B, c: C) => D) =>
(a: A) =>
(b: B) =>
(c: C) =>
f(a, b, c);
const curriedDelivery = curry3(delivery);
@le2sky
le2sky / curried-delivery.ts
Created May 29, 2022 02:37
curried-delivery
const delivery = (present: string) => (from: string) => (to: string) => {
return `
보내는 물건: ${present}
보내는 사람: ${from}
받는 사람: ${to}
`;
};
@le2sky
le2sky / compose-partial-application.ts
Last active May 29, 2022 02:31
compose-partial-application
//<A,B,C>((B) => C, (A) => B) => (A) => C
export const compose = <A,B,C>(g:(y:B) => C, f: (s: A) => B) => (x:A) => {
return g(f(x));
}
export function getPrice(name: string): number | undefiend {
if (name === "tomato") return 7000;
else if (name === "orange") return 15000;
else if (name === "apple") return 10000;
@le2sky
le2sky / partial-application.ts
Last active May 29, 2022 02:31
partial-application
const delivery => (present: string, from: string) => (to: string) => {
return `
보내는 물건: ${present}
보내는 사람: ${from}
받는 사람: ${to}
`
}
const momsPresent = delivery('상품권', '엄마')
momsPresent("아들");
@le2sky
le2sky / no-partial-but-pure.ts
Last active May 29, 2022 02:32
no-partial-but-pure
const delivery = (present: string, from: string, to: string) => {
return `
보내는 물건: ${present}
보내는 사람: ${from}
받는 사람: ${to}
`
}
delivery('상품권', '엄마', '아들');
delivery('상품권', '엄마', '딸');
@le2sky
le2sky / serverless-ec2.json
Last active May 29, 2022 02:32
serverless-ec2
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeNetworkInterfaces",
"ec2:CreateNetworkInterface",
"ec2:DeleteNetworkInterface",
"ec2:DescribeInstances",
@le2sky
le2sky / serverless-lambdaPolicy.json
Last active May 29, 2022 02:32
serverless-lambdaPolicy
{
"Version": "2012-10-17",
"Statement": [
{
"Action": ["logs:CreateLogStream", "logs:CreateLogGroup"],
"Resource": ["*"],
"Effect": "Allow"
},
{
"Action": ["logs:PutLogEvents"],
@le2sky
le2sky / serverless-deploy.json
Last active May 29, 2022 02:33
serverless-deploy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:CreateStack",
"cloudformation:Describe*",
"cloudformation:ValidateTemplate",
"cloudformation:DeleteChangeSet",
🌞 Morning 81 commits █▊░░░░░░░░░░░░░░░░░░░ 8.9%
🌆 Daytime 317 commits ███████▎░░░░░░░░░░░░░ 34.9%
🌃 Evening 489 commits ███████████▎░░░░░░░░░ 53.9%
🌙 Night 21 commits ▍░░░░░░░░░░░░░░░░░░░░ 2.3%