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
| CXX_FLAGS = -W | |
| SRC = different_stack_variable_policy.cpp | |
| all: | |
| @make gcc | |
| @echo "" | |
| @make clang | |
| gcc: | |
| @g++ $(SRC) $(CXX_FLAGS) |
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
| /* | |
| ## Sort Implementation | |
| * Selection Sort (Iterative / Recursive) | |
| * Bubble Sort (Iterative / Recursive) | |
| * Insertion Sort (Iterative / Recursive) | |
| * Interfaces is similar with std::sort() | |
| * Support comparator | |
| */ |
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
| #include <cstdio> | |
| #include <cstring> | |
| #include <cassert> | |
| typedef enum { | |
| MyOrderedAscending = -1, | |
| MyOrderSame, | |
| MyOrderedDescending | |
| } MyComparisonResult; |
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
| #include <type_traits> | |
| #include <cstdio> | |
| template<int... Items> | |
| struct intlist; | |
| template<typename intlist, int I> | |
| struct push_back; | |
| template<int I, int Head, int... Remainder> |
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
| /* | |
| type list๋ฅผ ์ฐธ์กฐํด์ ๋ง๋ int list์ car, cdr | |
| reference : http://coliru.stacked-crooked.com/a/0af9789bed2adaf7 | |
| */ | |
| #include <type_traits> | |
| #include <climits> | |
| template<int... Items> | |
| struct intlist; |
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
| #!/usr/bin/env python | |
| #-*- coding: utf-8 -*- | |
| ''' | |
| output sample | |
| initial create : 0.0293490886688 | |
| re-create #1 : 0.00163388252258 | |
| re-create #2 : 0.00191903114319 | |
| ์ต์ด ์์ฑ์์๋ง ๋๋ฆฌ๋ค. | |
| ''' |
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
| # https://twitter.com/Code_60/status/579601136300101632 | |
| # 15/03/22 | |
| # ์ด๋ฒ ์ฃผ์ ๋ "ํ์๊ณ"์ ๋๋ค. ์ด๋ค ํ๋ก๊ทธ๋จ์ด๋ ์๊ด์์ต๋๋ค. | |
| # ํ์๊ณ์ ๊ด๋ จ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํด ์ฃผ์๋ฉด ๋๊ฒ ์ต๋๋ค. | |
| # ์ด๋ฒ ๋ฏธ์ ์ "๋๋ ํ"์ ๋๋ค. ์ต๋ํ ์ฝ๊ธฐ ํ๋ค๊ณ , ๊ธด ์ฝ๋๊ฐ ๋ฏธ์ ์ด ๋๊ฒ ์ต๋๋ค. ๊ทธ๋ผ, ์์! | |
| # | |
| # ํ์ง๋ง ๋ ๋๋ ํ์ ๊ด์ฌ ์์ด์ ๋ช ์์ฑ์ ๊น ๋ค. | |
| solar_system = [:sun, :mercury, :venus, :earth, :mars, :jupiter, :saturn, :uranus, :neptune] | |
| Solar,System,Contains,Fixed,Star,And,Some,Planets,ANd,Pluto = solar_system | |
| puts "Pluto : #{Pluto}" |
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
| /** | |
| * https://twitter.com/Code_60/status/577062012250796032 | |
| * ์ค๋์ ์ฃผ์ ๋ "13์ผ์ ๊ธ์์ผ" ์ ๋๋ค. | |
| * Input : ๋ ์ | |
| * Output : ํด๋น ๋ ๋์ 13์ผ์ ๊ธ์์ผ์ด ํฌํจ๋ ์ | |
| * ex) input : 2015 output : 3 | |
| */ | |
| #include <cstdio> | |
| #include <vector> |
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
| #!/bin/bash | |
| if [ -z "$1" ] || [ "1" == "$1" ]; then | |
| echo 1 | |
| else | |
| next=$(( $1 - 1 )) | |
| prev=$(./factorial.sh $next) | |
| echo $(( $prev * $1 )) | |
| fi |
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
| /* | |
| http://en.wikipedia.org/wiki/C_Sharp_syntax#Closure_blocks | |
| C# | |
| public void Foo() | |
| { | |
| using (var bar = File.Open("Foo.txt")) | |
| { | |
| // do some work | |
| throw new Exception(); |