GitHub webhooks for a URL by default only fire on repo pushes. There appears to be no way in the web UI to set up webhooks for other events. And so we go to the API. I prefer to do this type of thing with Hurl.
{
"name": "web",
"active": true,
GitHub webhooks for a URL by default only fire on repo pushes. There appears to be no way in the web UI to set up webhooks for other events. And so we go to the API. I prefer to do this type of thing with Hurl.
{
"name": "web",
"active": true,
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
import com.lmax.disruptor.dsl.Disruptor | |
import java.util.concurrent.Executors | |
import com.lmax.disruptor._ | |
case class ValueEvent(var value: Long) | |
case class ValueEventTranslator(value: Long) extends EventTranslator[ValueEvent] { | |
def translateTo(event: ValueEvent, sequence: Long) = { | |
event.value = value | |
event |
import com.lmax.disruptor.dsl.Disruptor | |
import java.util.concurrent.Executors | |
import com.lmax.disruptor._ | |
case class ValueEvent(var value: Long) | |
case class ValueEventTranslator(value: Long) extends EventTranslator[ValueEvent] { | |
def translateTo(event: ValueEvent, sequence: Long) = { | |
event.value = value | |
event |
# The $provide service is used to override an injected dependency | |
# Bad - results in Error: [ng:areq] Argument 'fn' is not a function, got Object | |
module 'someModule', ($provide) -> | |
$provide.value "SomeService", SomeMock | |
# Good | |
module 'someModule', ($provide) -> | |
$provide.value "SomeService", SomeMock | |
null |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
sealed trait Interact[A] | |
case class Ask(prompt: String) | |
extends Interact[String] | |
case class Tell(msg: String) | |
extends Interact[Unit] | |
trait Monad[M[_]] { | |
def pure[A](a: A): M[A] |
Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.
But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.
For starters, here is the sort of thing that SI-2712 affects:
def foo[F[_], A](fa: F[A]): String = fa.toString
LIMIT = 5 | |
BOUND = 'object' | |
def prelude(limit: int, bound: str) -> None: | |
print('from typing import Callable, Iterable, Iterator, Tuple, TypeVar, overload') | |
print('Ts = TypeVar(\'Ts\', bound={bound})'.format(bound=bound)) | |
print('R = TypeVar(\'R\')') | |
for i in range(LIMIT): | |
print('T{i} = TypeVar(\'T{i}\', bound={bound})'.format(i=i+1, bound=bound)) |
sealed trait Decidable[+Proof] | |
final case class Yes[Proof](proof: Proof) extends Decidable[Proof] | |
final case object No extends Decidable[Nothing] | |
sealed trait List[+A] { | |
def nonEmpty: Decidable[this.type <:< ::[A]] | |
def ::[AA >: A](value: AA): ::[AA] = new ::[AA](value, this) | |
} | |
final case object Nil extends List[Nothing] { | |
def nonEmpty: Decidable[this.type <:< ::[Nothing]] = No |