Skip to content

Instantly share code, notes, and snippets.

View terjokhin's full-sized avatar
🏠
Working from home

Alexey Terekhin terjokhin

🏠
Working from home
  • Netherlands, Utrecht
View GitHub Profile
<table border = "0">
<tr>
<td>Username</td><td><input type="text" id="Username" name="Username" value="@logInForm("Username").value" placeholder="Your Username"></td>
</tr>
<tr>
<td>Password</td><td><input type="text" id="Username" name="Username" value="@logInForm("Password").value" placeholder="Your Password"></td>
</tr>
<tr>
<td align = "right">
<a href="@routes.Application.start()">
name := """PizzaInitial1"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
resolvers ++= Seq(
"RoundEights" at "http://maven.spikemark.net/roundeights"
object TestApp extends App {
trait Region {
val start: Int
val end: Int
def processRegion(input: String): String
}
object MongoApp extends App {
case class Data(_id: ObjectId, data: String)
object Data {
def apply(data: String): Data = new Data(new ObjectId(), data)
}
import org.bson.codecs.configuration.CodecRegistries.{fromProviders, fromRegistries}
@terjokhin
terjokhin / ForEach.scala
Created July 26, 2017 07:46
Generalizing over forEach operation. Smells bad. Works hard.
object ForEachExperiment extends App {
trait ForEach[M[_]] {
def foreach[V](m: M[V])(f: V => Unit ): Unit
}
object ForEachInstances {
@terjokhin
terjokhin / script.js
Created August 17, 2017 05:16
Traffic checker for yandex
var casper = require('casper').create({logLevel: "error"});
var url = 'https://yandex.ru/maps/213/moscow/?rtext=55.707218%2C37.962004~55.753747%2C37.681371&rtt=auto&l=trf%2Ctrfe&mode=routes&ll=37.818532%2C55.741678&z=11';
casper.options.viewportSize = { width: 1920, height: 1080 };
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36');
casper.start(url, function() {
casper.waitForSelector('.driving-route-view__route-title-primary', function() {
this.echo(this.evaluate(getSelectedItems));
});
});
val l1 = List(1,2,3,4,4,5)
val l2 = List(1,4,2,3,4,5)
val l3 = List(1,2,2,3,4,5)
def check[T](l1: List[T], l2: List[T]): Boolean = {
l1.groupBy(identity) == l2.groupBy(identity)
}
check(l1, l2)
check(l1, l3)
@terjokhin
terjokhin / scapegoat-not-working_build.sbt
Last active February 2, 2018 05:28
dummy-project-with-scapegoat
name := "scapegoat-not-working"
version := "0.1"
scalaVersion := "2.12.4"
scapegoatVersion in ThisBuild := "1.3.3"
const puppeteer = require('puppeteer');
let scrape = async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('https://yandex.ru/maps/213/moscow/?ll=37.820579%2C55.730541&z=12&mode=routes&rtext=55.707218%2C37.962004~55.753747%2C37.681371&rtt=auto');
await page.waitFor(3000);
const raw = await page.evaluate(() => {
case class Data(v: String, k: String)
case class DataMap(map: Map[String, Data])
val cfg = """
|example {
| map {
| "1" : {
| v: "v"
| k: "k"
| }