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
// es5 way | |
function capitalize(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
} | |
// es6 way using destructuring | |
const capitalize = ([first,...rest]) => first.toUpperCase() + rest.join(''); |
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
def reward_function(params): | |
''' | |
Example of rewarding the agent to follow center line | |
''' | |
# Read input parameters | |
track_width = params['track_width'] | |
distance_from_center = params['distance_from_center'] | |
all_wheels_on_track = params['all_wheels_on_track'] | |
speed = params['speed'] |
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
/** | |
* Initialize Immutable List | |
*/ | |
// 1. Java 8 or before | |
List<String> list1 = Arrays.asList("foo", "bar", "baz"); | |
// 2. Java 9 or later | |
List<String> list3 = List.of("foo", "bar", "baz"); | |
// 3. Using Streams |
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 com.example.thread; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Semaphore; | |
import java.util.concurrent.TimeUnit; | |
import java.util.stream.IntStream; | |
/** | |
* Semaphore is used when you want to limit maximum number of concurrent calls |
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 com.example.thread; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.TimeoutException; | |
/** |
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 com.example.util; | |
import java.io.File; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.util.Comparator; | |
import java.util.List; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipInputStream; |