Skip to content

Instantly share code, notes, and snippets.

View ufocoder's full-sized avatar
👽
🛸

Sergey ufocoder

👽
🛸
View GitHub Profile
router.get(url, function (req, res) {
function handleSuccess (file) {
res.writeHead(200, { "Content-Type": "application/octet-stream" });
res.write(file);
res.end();
}
function handleError (err) {
res.writeHead(404);
res.end();
}
function closeWithStatus (response, status, headers) {
const data = headers || {};
function end () {
response.writeHead(status, data);
response.end();
}
return end;
}
function closeWithContent (response, status, headers) {
const displayItems = storeItems
.filter(filterBy(systemCriteria))
.filter(filterBy(customerCriteria))
.sort(sortBy(primaryDimension, secondaryDimension));
class Car {
private Wheels wheel = new MRFWheels();
private Battery battery = new ExcideBattery();
...
...
}
class Car{
private Wheels wheel;
private Battery battery;
/*
Где-то в нашей кодовой базе мы инстанцирует объекты, требующие этот класс
Два варианта реализации внедрения зависимостей:
1. На основе конструктора
2. На основе setter-метода
*/
type alias Book =
{ isbn : String
, title : String
, authors : List String
, copyright : Int
, edition : Maybe String
}
type alias LibraryReport =
{ numBooks : Int
maximum : List comparable -> Maybe comparable
renderRow : String -> Int -> Html Msg
renderRow title data =
tr []
[ td [] [ text title ]
, td
[ style
[ ( "text-align", "right" )
, ( "min-width", "5rem" )
]
]
interface InjectWheels {
 public void setWheels(Wheels w);
}
interface InjectBattery {
 public void setBattery(Battery b);
}
class Car implements InjectWheels, InjectBattery {
 Wheels injectedWheels;