- Install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install rbenv and ruby-build
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
<?php | |
class UrlParser | |
{ | |
/** | |
* The url to be parsed | |
* @param String $url | |
*/ | |
public function __construct($url) | |
{ |
for key in MoveToPreviousThird MoveToRightDisplay MakeLarger MoveToRightHalf MakeSmaller MoveToTopDisplay MoveToBottomDisplay MoveToTopHalf MoveToBottomHalf MoveToUpperLeft MoveToCenter MoveToUpperRight MoveToFullscreen MoveToLeftDisplay MoveToLeftHalf MoveToLowerLeft RedoLastMove MoveToLowerRight MoveToNextDisplay MoveToNextThird MoveToPreviousDisplay UndoLastMove; do | |
printf "defaults write com.divisiblebyzero.Spectacle ${key} -data "; | |
defaults read com.divisiblebyzero.Spectacle ${key} | sed 's/[^0-9a-f]//g'; | |
done |
defmodule KeyVal.RegistryTest do | |
use ExUnit.Case, async: false | |
setup do | |
{:ok, registry} = KeyVal.Registry.start_link | |
{:ok, registry: registry} | |
end | |
test "spawns bucket", %{registry: registry} do | |
assert {:ok, _bucket} = KeyVal.Registry.create(registry, "shopping") |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Normally we would capture using the & syntax eg: &List.first/1 if we know exactly what to capture. How would I capture the function if the module name and function name is stored in a variable example:
module_name = List
function = :size
arity = 2
Now how would I capture the function dynamically?
The goal is to support soft delete functionality in Ecto.Repo
. With the suggestion by @imranismail, another repo is created and the remaining functionalities are delegate to the original MyApp.Repo
.
The new repo get/2
and all/1
functions will exclude the soft deleted record by default. delete/1
and delete_all/1
will update the delete_at
column by default instead of deleting.
MyApp.Repo.get(MyApp.User, 1) //will return nil if record is in soft delete state
One way one would do it i to connect nodes together by having the sys.config/vm.args as suggested by chrismccord here
However, when deploying to platform such as Kubernetes or AWS ElasticBeanstalk whereby the cluster is elastic and the IPs that are attached to the nodes are ephemeral, you probably don't want to update sys.config/vm.args everytime you do a deployment now would you.
Now, to solve this one would need to use a Discovery Service such as Consul/etcd/Zookeeper, I opt to use Kubernetes as it's one of the best PaaS for containerized apps available right now and also has a RESTful API for querying resources such as node IPs.
How it's done is that the Iris.Kubernetes
process will poll the API endpoint every 5 seconds for new IPs that are available in the cluster and attempt a connection.
version: '2' | |
services: | |
db: | |
image: postgres | |
restart: always | |
environment: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
volumes: | |
- ./.data/postgres:/var/lib/postgresql/data |
version: '2' | |
services: | |
db: | |
image: mariadb | |
restart: always | |
volumes: | |
- ./docker/data/mysql:/var/lib/mysql | |
ports: | |
- "3306:3306" |