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
#custom development | |
mariadb: | |
image: mariadb:latest | |
container_name: mariadb | |
env_file: ./database/.env | |
ports: | |
- "3306:3306" | |
volumes: | |
- /home/user/data/mariadb:/var/lib/mysql |
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 org.parboiled2._ | |
import org.parboiled2.CharPredicate._ | |
class URLParser(val input: ParserInput) extends Parser { | |
def URL = rule { URLPattern ~> UrlParts } | |
def URLPattern = rule { Scheme ~ "://" ~ Host ~ Port ~ Path ~ QueryParams } | |
def QueryParams = rule { '?' ~ oneOrMore(QPPair).separatedBy('&') ~> (kvs => Map(kvs: _*)) } |
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 java.util.concurrent.{Executor, Executors} | |
import java.util.concurrent.atomic.AtomicReference | |
import scala.annotation.tailrec | |
import scala.util.{Failure, Success, Try} | |
import scala.util.control.NonFatal | |
object Future { | |
def apply[T](expression: => T)(implicit executor: Executor) = new FutureImpl(expression) | |
} |
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
/** | |
* Простейшая реализация FRP в виде сигналов, моделирующих значения, зависимые от времени. | |
* | |
* Из курса "Functional Program Design in Scala" (2016), Lecture 4.3 | |
* https://www.coursera.org/learn/progfun2/lecture/5lWVa/lecture-4-3-a-simple-frp-implementation | |
*/ | |
trait SimpleFRP { | |
class Signal[T](expr: => T) { |
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
/** | |
* Решает задачу о N ферзях [1] для шахматной доски размером NxN. | |
* | |
* Возвращает множество возможных расстановок ферзей на шахматной доске, | |
* такие, чтобы ни один не находился под боем другого. | |
* | |
* Реализация основана на материале [2] курса | |
* "Functional Programming Principles in Scala" (2016), лекция 6.3. | |
* | |
* Источники: |
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 Bools extends App { | |
class Bool(negated: () => Bool) { | |
def not = negated() | |
} | |
val True: Bool = new Bool(() => False) | |
val False: Bool = new Bool(() => True) | |
assert(True == True) | |
assert(False == False) |
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
#!/usr/bin/env python | |
# DEPENDENCIES: | |
# - requests | |
# Installation: aptitude install python-requests | |
import requests | |
import sys | |
from time import time, sleep |
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
//In subdirectory src/Foo | |
package Foo | |
object Bar { | |
val str = "Hello, world!" | |
} |
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
<div id="container"> | |
<h1>Hello Plunker!</h1> | |
<p>Привет, ребята!</p> | |
</div> |
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 selectionSort[T <% Ordered[T]](seq: Seq[T]): Seq[T] = { | |
def pickMax(seq: Seq[T]): (T, Seq[T]) = | |
seq.tail.foldRight((seq.head, Seq.empty[T])) { | |
case (next, (max, passed)) => | |
if (next > max) | |
(next, max +: passed) | |
else | |
(max, next +: passed) | |
} |
NewerOlder