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 class ControllerExtensions | |
{ | |
public static void GetErrors(this Controller controller, object model, OperationResult result) | |
{ | |
if (model == null) | |
{ | |
result.Errors.Add("Ошибка ввода данных"); | |
} | |
result.Errors.AddRange(controller.ModelState.Values.SelectMany(v => v.Errors | |
.Where(b => !string.IsNullOrEmpty(b.ErrorMessage)) |
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
export class DecoratorFactory { | |
public createWithCallback(func: Function, callback: any) { | |
if (!callback || typeof (callback) !== "function") | |
return undefined; | |
return function () { | |
const result = func.apply(this, arguments); // (*) | |
callback(); | |
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
package FirstLab | |
object Application{ | |
def main(args: Array[String]):Unit={ | |
println("List:"); | |
val list = List(1,2,3,4,5,6,7,8,9,10); | |
printList(list); | |
println(); | |
println("Recursive func:") | |
printList(recursive(list)) |
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
# Анализ популярности операционных систем Unix | |
# Автор: denismaster | |
# Github: denismaster | |
# Лицензия: MIT | |
# In[1]: | |
# Импорт библиотек для работы с данными | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pylab as plt |
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
object Main extends App { | |
def processList1(list: List[(Int, Int)]): List[Option[Double]] = | |
list.map(elem => { | |
val (c, z) = elem | |
z match { | |
case 0 => None | |
case _ => Some(c*1.0/z) | |
} | |
}) |
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
object Main extends App { | |
val counterFunc: () => Int = { | |
var count = 0 | |
() => { | |
count = count + 1 | |
val returnVal = count | |
returnVal | |
} | |
} | |
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
object Main extends App { | |
def identity[T](value: T): T = value | |
class Box[T] { | |
self => | |
var value: Option[T] = None | |
def save(arg: T): Unit = value = Some(arg) | |
def get: T = value.get |
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 numpy | |
import matplotlib.pyplot as plt | |
print("Введите X_min") | |
xmin=int(input()) | |
print("Введите X_max") | |
xmax=int(input()) | |
xcoords = numpy.arange(xmin, xmax+1, 0.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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Test tasl</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" type="text/css" media="screen" href="main.css" /> | |
</head> |
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'; | |
import ReactDOM from 'react-dom'; | |
import { Subject } from 'rxjs'; | |
import { startWith, scan } from 'rxjs/operators' | |
// create our stream as a subject so arbitrary data can be sent on the stream | |
const action$ = new Subject(); | |
// Initial State | |
const initState = { name: 'Harry' }; |
OlderNewer