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
from collections import namedtuple | |
Repo = namedtuple('Repo', 'name stars forks') | |
def get_repo_stats(user, n=5): | |
"""Takes a Github user object and returns the top n most popular repos by star count, | |
skips forks.""" | |
repos = [] |
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
from discord.ext import commands | |
from bb8.embed import CardImage | |
from bb8.search import Search | |
from bb8.swdestinydb import SWDestinyDBClient | |
import logging | |
import os | |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN") |
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.language.higherKinds | |
import cats.data._ | |
import cats.effect.Sync | |
import cats.implicits._ | |
import org.http4s.HttpService | |
import org.http4s.dsl.Http4sDsl | |
import org.http4s.implicits._ | |
class Example[F[_] : Sync] extends Http4sDsl[F] { |
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
Traceback (most recent call last): | |
File "./env/lib/python3.5/site-packages/peewee.py", line 3688, in _create_connection | |
return self._connect(self.database, **self.connect_kwargs) | |
File "./env/lib/python3.5/site-packages/peewee.py", line 3939, in _connect | |
conn = sqlite3.connect(database, **kwargs) | |
sqlite3.OperationalError: unable to open database file | |
During handling of the above exception, another exception occurred: | |
Traceback (most recent call last): |
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
final class Reporter(scheduler: Scheduler) extends Observable[Payload] { | |
implicit val s = scheduler | |
// TODO define overflow strategy. | |
private val subject = ConcurrentSubject.publish[Payload]() | |
def unsafeSubscribeFn(subscriber: Subscriber[Payload]): Cancelable = { | |
subject.unsafeSubscribeFn(subscriber) | |
} |
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
final case class UserId(id: Long) extends AnyVal | |
final case class User(email: String, name: String, passwordDigest: String, createdAt: Instant, updatedAt: Instant) | |
final case class UserAndId(user: User, id: UserId) | |
sealed abstract class SignupError extends Product with Serializable | |
case object EmailAlreadyUsed | |
final case class Authenticated(email: String, token: Token) | |
final case class Token(get: UUID = UUID.randomUUID()) |
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
java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext | |
at org.apache.logging.log4j.core.LoggerContext.getContext(LoggerContext.java:178) | |
at org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:290) | |
at org.elasticsearch.common.logging.Loggers.setLevel(Loggers.java:149) | |
at org.elasticsearch.common.logging.Loggers.setLevel(Loggers.java:144) | |
at org.elasticsearch.index.SearchSlowLog.setLevel(SearchSlowLog.java:114) | |
at org.elasticsearch.index.SearchSlowLog.<init>(SearchSlowLog.java:109) | |
at org.elasticsearch.index.IndexModule.<init>(IndexModule.java:114) | |
at org.elasticsearch.indices.IndicesService.createIndexService(IndicesService.java:406) | |
at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:378) |
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
trait ApplicationComponent extends BuiltInComponents with SlickComponents | |
with I18nComponents with EvolutionsComponents with SlickEvolutionsComponents { | |
lazy val dbConfigProvider: DatabaseConfigProvider = new DatabaseConfigProvider { | |
override def get[P <: BasicProfile]: DatabaseConfig[P] = api.dbConfig(DbName("default")) | |
} | |
lazy val router: Router = wire[Routes] withPrefix "/" | |
lazy val assets: Assets = wire[Assets] |
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 models | |
import org.specs2.mutable.Specification | |
import play.api.Play.current | |
import play.api.db.slick.{DB, Session} | |
import play.api.db.slick.Config.driver.simple._ | |
import play.api.test.FakeApplication | |
import play.api.test.Helpers._ | |
class UserSpec extends Specification { |
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
<module xmlns="urn:jboss:module:1.1" name="company.handler"> | |
<resources> | |
<resource-root path="company-handler.jar" /> | |
</resources> | |
<dependencies> | |
<module name="javax.api"/> | |
<module name="org.jboss.logging"/> | |
<module name="org.javassist" /> | |
<module name="org.jboss.as.logging" export="true"> |
NewerOlder