A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
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
""" htool :: Haskell Tool | |
Module of borrowed operators from Haskell implemented in Python for the purpose | |
of gaining more familiarity with functional programming in a familiar | |
environment. | |
""" | |
__author__ = 'CjHanks' | |
__license__ = 'Free' | |
from operator import lt, gt |
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
#signals.py | |
from django.dispatch import Signal | |
user_login = Signal(providing_args=["request", "user"]) | |
#views.py | |
from foo import signals |
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
var apply = Function.prototype.apply; | |
var flatten = apply.bind([].concat, []); | |
Array.of = function (a) { | |
return [a]; | |
}; | |
Array.prototype.chain = function (f) { | |
return flatten(this.map(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
#!/usr/bin/env python | |
def curry(func): | |
""" | |
Decorator to curry a function, typical usage: | |
>>> @curry | |
... def foo(a, b, c): | |
... return a + b + c |
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 fl = require('fantasy-land') | |
const inspect = require('util').inspect.custom | |
// Fantasy Land | |
// of :: Applicative f => a -> f a | |
// map :: Functor f => f a ~> (a -> b) -> f b | |
// ap :: Apply f => f a ~> f (a -> b) -> f b | |
// chain :: Chain m => m a ~> (a -> m b) -> m 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
const I = x => x | |
const K = x => y => x | |
const A = f => x => f (x) | |
const T = x => f => f (x) | |
const W = f => x => f (x) (x) | |
const C = f => y => x => f (x) (y) | |
const B = f => g => x => f (g (x)) | |
const S = f => g => x => f (x) (g (x)) | |
const S_ = f => g => x => f (g (x)) (x) | |
const S2 = f => g => h => x => f (g (x)) (h (x)) |
The following commands will start a container with Kafka and Zookeeper running on mapped ports 2181 (Zookeeper) and 9092 (Kafka).
docker pull spotify/kafka
docker run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=kafka --env ADVERTISED_PORT=9092 --name kafka spotify/kafka
ADVERTISTED_HOST
was set to kafka
, which will allow other containers to be able to run Producers and Consumers.
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
// Sometimes, you might want to supply *some* config, but | |
// not necessarily *all*. Maybe your password is really | |
// secret, so you don't want to risk saving it in a config | |
// file. In which case, you'll want to ask the user to enter | |
// it when your script runs. | |
// This interface provides a flexible approach, where | |
// the user is prompted for a missing key when it's | |
// requested - if a particular key isn't needed for a given | |
// run, the user won't need to enter it. Of course, if the |
When running FastAPI
app, all the logs in console are from Uvicorn
and they do not have timestamp and other useful information. As Uvicorn
applies python logging
module, we can override Uvicorn
logging formatter by applying a new logging configuration.
Meanwhile, it's able to unify the your endpoints logging with the Uvicorn
logging by configuring all of them in the config file log_conf.yaml
.
Before overriding:
uvicorn main:app --reload
OlderNewer