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 React from 'react'; | |
// This is more closely related to real world | |
const InexistantCustomer = () => { | |
return ( | |
<div> | |
<h2>Inexistant customer</h2> | |
<p>Sorry, we couldn't find any customer matching your criteria.</p> | |
</div> | |
); |
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 React from 'react'; | |
const NullCustomer = () => { | |
return ( | |
<div> | |
<h2>No customer found</h2> | |
<p>Sorry, we couldn't find any customer matching your criteria.</p> | |
</div> | |
); | |
}; |
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.EmptyStackException; | |
import java.util.Stack; | |
public class SchrodingerStack<T> { | |
private Stack<T> stack; | |
private boolean isEmpty; | |
public SchrodingerStack() { | |
stack = new Stack<>(); | |
isEmpty = true; |
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.EmptyStackException; | |
import java.util.Stack; | |
public class SchrodingerStack<T> { | |
private Stack<T> stack; | |
private boolean isEmpty; | |
public SchrodingerStack() { | |
stack = new Stack<>(); | |
isEmpty = true; |
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 factorial(n): | |
if n == 0: | |
return 1 | |
return n * factorial(n-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
memo = {} | |
def factorial_with_memo(n): | |
if n in memo: | |
return memo[n] | |
if n == 0: | |
return 1 | |
result = n * factorial_with_memo(n-1) | |
memo[n] = result | |
return result | |
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 const string FORMAT_JPG = "JPG"; | |
public const string FORMAT_GIF = "GIF"; | |
public const string FORMAT_PNG = "PNG"; | |
// OR | |
public enum ImageFormat | |
{ | |
JPG, | |
GIF, |
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 const FORMAT_JPG = 1; | |
public const FORMAT_GIF = 2; | |
public const FORMAT_PNG = 3; |
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
<? | |
$sourceFile = 'C:\temp\source.txt'; | |
$destination = 'C:\temp\destination :txt'; | |
// The filename is simplified | |
// and might come from a programmatic construction | |
$copyWasSuccessful = copy($sourceFile, $destination); | |
if (!$copyWasSuccessful || !$file_exists($destination)) { | |
// Don't trust the function result. Handle the postcondition error |
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
<? | |
$sourceFile = 'C:\temp\source.txt'; | |
$destination = 'C:\temp\destination.txt'; | |
$copyWasSuccessful = copy($sourceFile, $destination); // true | |
$destinationFileExists = file_exists($destination); // true | |
$sourceFile = 'C:\temp\source.txt'; | |
$destination = 'C:\temp\destination :txt'; | |
// The filename is simplified |
NewerOlder