Source Tree와 함께 Git
, GitHub
를 배워보려고 합니다.
좋은 시간이 되었으면 좋겠습니다 👍
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
// Test the auto currying function | |
function curry(fn) { | |
return (function next(fn, initLength, ...args) { | |
if(initLength <= args.length) { | |
return fn(...args); | |
} else { | |
return function(...nextArgs) { | |
return next.apply(null, [fn, initLength, ...args, ...nextArgs]); | |
//return next(fn, initLength, ...[...args, ...nextArgs]); | |
} |
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
import java.util.Arrays; | |
public class FillArray { | |
/** | |
* 샘플. 1차원 배열과, 배열에 채울 값을 인자로 전달받아서 배열을 채우기 | |
* int[] array = new int[5]; | |
* sample(array, 5); | |
* -> [5, 5, 5, 5, 5] | |
*/ | |
public void sample(int[] array, int number) { |
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
import java.util.Arrays; | |
public class FillArray { | |
/** | |
* 샘플. 1차원 배열과, 배열에 채울 값을 인자로 전달받아서 배열을 채우기 | |
* int[] array = new int[5]; | |
* sample(array, 5); | |
* -> [5, 5, 5, 5, 5] | |
*/ | |
public void sample(int[] array, int number) { |
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
public class LightController { | |
private int lightStatus; | |
/** | |
* 인자 n과 status를 전달받아서 n 번째 비트를 status에 따라 1 또는 0으로 설정 | |
* status가 true이면 1로, false이면 false로 설정 | |
* | |
* lightStatus 값이 이진수로 ...00000000 이라고 했을 때 | |
* turn(3, true);를 호출한다면 3번 째 비트를 1로 만들어야 하므로 turn(3, true)의 결과는 | |
* ...00000100 |
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
function generate() { | |
var numbers = []; | |
for(var i=0; i<6; i++) { | |
var number = Math.floor(Math.random() * 45) + 1; | |
if(contains(numbers, number)) { | |
i--; | |
} else { | |
numbers.push(number); |
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
import java.util.Arrays; | |
import java.util.HashSet; | |
import java.util.Scanner; | |
import java.util.Set; | |
import javax.script.ScriptException; | |
/** | |
* 네이버 지식in 답변을 위해 작성한 콘솔 계산기 예제 코드입니다. | |
* |
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
public class RecursiveCall { | |
public static void main(String[] args) { | |
call(1); | |
} | |
static void call(int depth) { | |
System.out.println(depth); | |
call(depth + 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
package project; | |
import java.util.Random; | |
import java.util.Arrays; | |
import java.util.Set; | |
import java.util.HashSet; | |
public class LottoGenerator { | |
private Random random = new Random(System.nanoTime()); | |
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
public String extract(String url) throws Exception { | |
OkHttpClient client = getUnsafeOkHttpClient(); | |
// 요청 정보 객체 생성 | |
Request request = new Request.Builder() | |
.url(url) | |
.addHeader("Accept", "text/html") | |
.addHeader("User-Agent", "chrome의 User-Agent값") | |
.addHeader("referer", "https://www.google.com") | |
.build(); |
NewerOlder