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
# table storage | |
id | sha1 | count | |
----+------------------------------------------+------- | |
17 | dc9793d8f2379b73c4932d33a14c75eefa849fda | 64 | |
# table file | |
id | storage_id | name | |
-----+------------+----------------------- | |
113 | 17 | OdioCondimentumId.avi | |
114 | 17 | Venenatis.png |
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
{ | |
"_id": 17, | |
"sha1": "dc9793d8f2379b73c4932d33a14c75eefa849fda", | |
"count": 64, | |
"files": [ | |
{ | |
"id": 1, | |
"name": "OdioCondimentumId.avi" | |
}, | |
{ |
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
SELECT s.id, s.sha1, f.name | |
FROM storage s | |
JOIN file f ON s.id = f.storage_id | |
WHERE s.count > 0 | |
ORDER by id DESC, name ASC | |
OFFSET 1000 LIMIT 10 |
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
db.file_storage.aggregate([ | |
{$match: {"count": {$gt: 0}}}, | |
{$unwind: "$files"}, | |
{$project: {_id: 1, sha1: 1, "name": "$files.name"}}, | |
{$sort: {_id: -1, "name": 1}}, | |
{$skip : 1000}, | |
{$limit : 10}, | |
]) |
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 Form | |
{ | |
protected $name; | |
public function getName() | |
{ | |
return $this->name; | |
} |
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 ValueObject | |
{ | |
protected $name; | |
public function __construct(array $args) | |
{ | |
if (!isset($args['name']) || $args['name'] === '') { | |
throw new InvalidArgumentException('name cannot be blank'); |
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
#!/bin/bash | |
tid='UA-109851522-1' | |
cid=`php -r 'echo rand();'` | |
curl -i 'https://www.google-analytics.com/collect?v=1&t=event&tid='$tid'&cid='$cid'&ec=shellClick&ea=click.shell&el=cli&ev=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
<?php | |
class ValueObject | |
{ | |
protected $name; | |
private function __construct() | |
{} | |
public static function fromArray(array $args) | |
{ | |
if (!isset($args['name']) || $args['name'] === '') { | |
throw new InvalidArgumentException('name cannot be blank'); |
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
// controller | |
func SignUp(username string) { | |
msg := "ok" | |
if err := service.SignUp(username); err != nil { | |
msg = err.Error() | |
} | |
fmt.Printf("[error] SignUp: %s \n", msg) | |
} |
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
// service | |
func SignUp(username string) error { | |
if err := validation(username); err != nil { | |
return fmt.Errorf("validation failed, error: %s", err) | |
} | |
if err := signUpFacebook(username); err != nil { | |
return fmt.Errorf("facebook sign up failed, error: %s", err) | |
} | |
if err := signUpTwitter(username); err != nil { |