It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.
This file contains 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
// extract from TELENOR https://ecaf.telenor.com.mm/?orcf=1&lang=my | |
const townships = [ | |
[ | |
"AhGaYa", | |
"BaMaNa", | |
"DaHpaYa", | |
"HaPaNa", | |
"HpaKaNa", | |
"KaMaNa", |
This file contains 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 ruby | |
# NOTE: Requires Ruby 2.1 or greater. | |
# This script can be used to parse and dump the information from | |
# the 'html/contact_info.htm' file in a Facebook user data ZIP download. | |
# | |
# It prints all cell phone call + SMS message + MMS records, plus a summary of each. | |
# | |
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created |
This file contains 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
defmodule StableMatching.Preference do | |
@enforce_keys [:id, :prefers] | |
defstruct id: nil, prefers: [] | |
end | |
defmodule StableMatching.GaleShapley do | |
alias StableMatching.Preference | |
@doc """ | |
Solves [stable matching problem](https://en.wikipedia.org/wiki/Stable_marriage_problem#Algorithm) |
- String concatenation:
Hopefully this may speed your groking of the forking torturing Y Combinator a little bit.
Disclaimer: I don't assert what I say here is accurate, or even correct (I'm not authorative, obviously), but it's my understanding and I'm sharing in the hope that someone who also struggles on the Y Combinator may benefit a tad.
- In Lambda Caculus, everything is a Lambda Caculus (Anonymous function that takes one parameter). And the best thing is that, ... drump roll ..., it's Turing Complete. So theoretically, it can caculate anything a computer can.
- In this note, I use the term
function
, which (I think) means Lambda Caculus, to sound (at least to myself) more accustomed.
- Y = λf.(λx.f (x x)) (λx.f (x x))
This file contains 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
<html> | |
<body> | |
<h2>Privacy Policy</h2> | |
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended | |
for use as is.</p> | |
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and | |
disclosure of Personal Information if anyone decided to use [my|our] Service.</p> | |
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in | |
relation with this policy. The Personal Information that [I|we] collect are used for providing and | |
improving the Service. [I|We] will not use or share your information with anyone except as described |
This file contains 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
// Basic Operators | |
35 + 98 | |
62 - 14 | |
50 / 10 | |
463 * 173 | |
// Types | |
var age: Int = 21 // Int = Integer = Any whole number | |
var milesCanRun: Double = 0.75 // Double = Float = Decimal Number |
- Resource Lists
- Awesome Elixir Resource List https://github.com/h4cc/awesome-elixir
- Elixir Talks https://github.com/elixir-lang/elixir/wiki/Talks
- Phoenix Framework http://www.phoenixframework.org/
- Elixir Official Site http://elixir-lang.org/
NewerOlder