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
docker rm `docker ps-a -q` |
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
vagrant init ubuntu/trusty64; vagrant up --provider virtualbox |
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 EmailSender { | |
private $db; | |
public function __construct(DatabaseConnection $db) | |
{ | |
$this->db = $db; | |
} |
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 UserProviderInterface { | |
public function findUserById($id); | |
} | |
class UserProvider implements UserProviderInterface { |
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 Personel { | |
private $name; | |
private $surname; | |
private $email; | |
public function getName() | |
{ |
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 Personel { | |
private $db; | |
public function __construct(DatabaseConnection $db) | |
{ | |
$this->db = $db; | |
} |
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 pascal(n): | |
if n == 1: | |
return [1] | |
else: | |
p_line = pascal(n - 1) | |
line = [p_line[i] + p_line[i + 1] for i in range(len(p_line) - 1)] | |
line.insert(0, 1) | |
line += [1] | |
return line |
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
words = { | |
'lorem': 1, | |
'ipsum': 2, | |
'dolor': 3, | |
'sit': 4, | |
'amet': 5 | |
} | |
def get_the_key(my_dict, value): | |
return my_dict.keys()[my_dict.values().index(value)] |
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
a = " Lorem ipsum" | |
b = " " | |
("%s %s" % (a , b)).strip() # 'Lorem ipsum' | |
"%s %s" % (a , b) # ' Lorem ipsum ' |
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 fibonacci($item) { | |
$a = 0; | |
$b = 1; | |
for ($i = 0; $i < $item; $i++) { | |
yield $a; | |
$a = $b - $a; | |
$b = $a + $b; | |
} |