This file contains hidden or 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
const _ = require('lodash'); | |
const { mapSeries } = require('bluebird'); | |
// express handler | |
async (req, res) => { | |
const sfExecutionIdHeader = req.header('SF-Execution-Id'); | |
const executionId = sfExecutionIdHeader.substring(sfExecutionIdHeader.lastIndexOf(':') + 1); | |
const ids = await selectIdsFromDb(); | |
const batches = _.chunk(ids, config.get('batch_size')); |
This file contains hidden or 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 org.myproject.scalaonly | |
import java.nio.charset.Charset | |
import java.nio.file.StandardWatchEventKinds.{ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY} | |
import java.nio.file.WatchEvent.Kind | |
import java.nio.file._ | |
import java.util.concurrent.locks.ReentrantReadWriteLock | |
import java.util.logging.{Level, LogManager} | |
import ch.qos.logback.classic.joran.JoranConfigurator |
This file contains hidden or 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 scala.util.control.NonFatal | |
sealed trait Response[+A] { | |
def returnValue: Option[A] | |
def map[B](f: A => B): Response[B] | |
def flatMap[B](f: A => Response[B]): Response[B] | |
} |
This file contains hidden or 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 sys | |
import re | |
from os import listdir | |
from os.path import isfile, join | |
from collections import OrderedDict | |
RESOURCES_FILE = "resources-enqueue.php" | |
OUT_FILE_PREFIX = "lang-" | |
OUT_FILE_SUFFIX = ".js" |
This file contains hidden or 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.net.InetSocketAddress | |
import java.security.{KeyStore, SecureRandom} | |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http.{HttpServerTerminated, HttpTerminated, ServerBinding} | |
import akka.http.scaladsl.server.{Route, RouteResult, RoutingLog} | |
import akka.http.scaladsl.settings.{ParserSettings, RoutingSettings} | |
import akka.http.scaladsl.{ConnectionContext, Http} | |
import akka.stream.{ActorMaterializer, ActorMaterializerSettings} | |
import com.typesafe.scalalogging.StrictLogging |
This file contains hidden or 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 akka.http.scaladsl.server.{Directives, Route} | |
import com.typesafe.scalalogging.StrictLogging | |
import scala.concurrent.ExecutionContext | |
class ServerRoutes(metricsActorRef: ActorRef, cardActorRef: ActorRef, helloActorRef: ActorRef) | |
extends Pagination with Directives with StrictLogging { | |
/* --- Methods --- */ |
This file contains hidden or 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 akka.actor.ActorSystem | |
import akka.http.scaladsl.client.RequestBuilding | |
import akka.http.scaladsl.model.{HttpResponse, StatusCodes} | |
import akka.http.scaladsl.unmarshalling.Unmarshal | |
import com.typesafe.scalalogging.StrictLogging | |
import HttpClient | |
import scala.concurrent.Future | |
class HttpServerAPI(lowThroughputClient: HttpClient, highThroughputClient: HttpClient) |
This file contains hidden or 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 akka.actor.ActorSystem | |
import akka.http.scaladsl.coding.Gzip | |
import akka.http.scaladsl.model.{HttpRequest, HttpResponse, ResponseEntity, StatusCode} | |
import akka.http.scaladsl.unmarshalling.{Unmarshal, Unmarshaller} | |
import akka.http.scaladsl.{ConnectionContext, Http} | |
import akka.stream._ | |
import akka.stream.scaladsl.{Keep, Sink, Source} | |
import com.typesafe.scalalogging.StrictLogging | |
import com.typesafe.sslconfig.akka.AkkaSSLConfig | |
import javax.net.ssl._ |
This file contains hidden or 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 createNonUniqueOrReturnExisting(name: String)(implicit session: DBSession = DB.autoCommitSession): Long = { | |
// here lies the query | |
} |
This file contains hidden or 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
WITH | |
val (l_name,d_label ) AS | |
(values | |
(? , ?) | |
), | |
ins AS | |
( INSERT INTO | |
label (label_name, device_label) | |
SELECT l_name, d_label FROM val | |
ON CONFLICT ON CONSTRAINT label_name_unique DO NOTHING |
NewerOlder