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
books = [ | |
{ | |
'id': 1, | |
'title': 'To Kill a Mockingbird', | |
'author': 'Harper Lee', | |
'publication_year': 1960, | |
'genre': 'Southern Gothic' | |
}, | |
{ | |
'id': 2, |
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
on: [ push ] | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 |
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 org.junit.Test; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
import static org.hamcrest.CoreMatchers.containsString; | |
import static org.hamcrest.CoreMatchers.is; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import static org.junit.Assert.assertTrue; | |
import static org.junit.Assert.fail; |
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 abc | |
class LineEncoder: | |
def __init__(self, algorithm): | |
self.algorithm = algorithm | |
def encode(self, text): | |
words = text.split(" ") |
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 restaurant; | |
public class HeadChef { | |
private final Chef pastryChef; | |
private final Waiter waiter; | |
public HeadChef(Chef pastryChef, Waiter waiter) { | |
this.pastryChef = pastryChef; | |
this.waiter = waiter; | |
} |
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.iteratrlearning.collections.examples._4_sets; | |
import com.iteratrlearning.collections.examples.ProductFixtures; | |
import org.junit.Test; | |
import static com.iteratrlearning.collections.examples.ProductFixtures.*; | |
import static org.hamcrest.Matchers.containsInAnyOrder; | |
import static org.junit.Assert.assertThat; | |
public class ProductCatalogueTest { |
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.iteratrlearning.collections.examples._1_what_are_collections; | |
import java.util.AbstractCollection; | |
import java.util.Collection; | |
import java.util.Iterator; | |
public class CollectionExamples { | |
public static void main(String[] args) { |
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
object PigLatin { | |
fun translate(phrase: String): String = phrase.split(" ").joinToString(" ", transform = ::translateWord) | |
private fun translateWord(word: String): String = | |
when { | |
word.startsWith(vowel) -> word + "ay" | |
word.startsWith("xr") -> word + "ay" | |
word.startsWith("yt") -> word + "ay" | |
word.startsWith("ch") -> word.drop(2) + "chay" |
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
from unittest.mock import Mock | |
from order import Order | |
ROAST_CHICKEN = Order("roast chicken") | |
APPLE_TART = Order("apple tart") | |
class HeadChef: | |
def __init__(self, pastrychef, waiter): |
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 org.junit.Test; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import static org.hamcrest.core.Is.is; | |
import static org.junit.Assert.fail; | |
public class WimbledonScoreCalcTest { | |
private WimbledonScoreCalc scoreCalc= new WimbledonScoreCalc(); |
NewerOlder