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
#read the comment below first | |
#paster this line into your .vimrc file | |
#<leader> is mapped to , | |
map ,g gx u | |
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 static int stringBased(int number) { | |
return String.valueOf(number).length(); | |
} | |
public static int logarithmBased(int number) { | |
return (int) Math.log10(number) + 1; | |
} | |
public static int repeatedMultiplication(int number) { | |
int length = 0; |
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
int num = 8; | |
int base = 2; | |
double log = Math.log(num) / Math.log(base); | |
System.out.println(log); |
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
private Integer newSize(Integer currentSize, Integer inputSize) { | |
if (currentSize > inputSize) { | |
return currentSize * 2; | |
} else if (currentSize < inputSize) { | |
return (inputSize % currentSize == 0) ? (currentSize + inputSize) : (currentSize + inputSize + 1); | |
} else { | |
return currentSize + inputSize; | |
} | |
} |
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
#.dockerignore | |
#Sets the Base Image for subsequent instructions. | |
FROM | |
#(deprecated - use LABEL instead) Set the Author field of the generated images. | |
MAINTAINER | |
#execute any commands in a new layer on top of the current image and commit the results. | |
RUN |
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
<?php | |
class Money | |
{ | |
private function __construct($currency, $amount) | |
{ | |
$this->currency = $currency; | |
$this->amount = $amount; | |
} | |
public static function fromString($currency, $amount) |
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
<?php | |
interface Vehicle{} | |
class Car implements Vehicle{} | |
class Track implements Vehicle{} | |
class Fruit{} | |
class Collection | |
{ | |
protected $items = []; |
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
<?php | |
function camel_to_snake($input) | |
{ | |
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input)); | |
} | |
function snakeToCamel($input) | |
{ | |
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input)))); | |
} |
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
<?php | |
namespace SomeApp\Application\DTO; | |
use Symfony\Component\OptionsResolver\OptionsResolver; | |
abstract class AbstractRequest | |
{ | |
public function __construct(array $data) |
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
<?php | |
interface ReadPostRepository | |
{ | |
public function byId(PostId $id); | |
public function all(); | |
public function byCategory(CategoryId $categoryId); | |
public function byTag(TagId $tagId); | |
public function withComments(PostId $id); | |
public function groupedByMonth(); |
NewerOlder