I hereby claim:
- I am bratsche on github.
- I am bratsche (https://keybase.io/bratsche) on keybase.
- I have a public key ASB1iVAvshnnFu_8fyzVI-1OBhcehQUwyy_ScHu7enY-TAo
To claim this, I am signing this object:
Notes on why I think Elixir is worth using for us | |
* Phoenix Channels - able to support 2 million concurrent clients on a single server. | |
* Node.js has an equivalent feature called SocketIO | |
* Ruby on Rails has an equivalent feature called ActionCable | |
* Not aware of any similar feature in Python | |
* Concurrency | |
* Ruby, restricted by a GIL | |
* Python, restricted by a GIL, but there is a proposal to remove it. Not sure how long it will take to remove it. | |
* Node.js, single-threaded async |
defmodule ExperimentsWeb.ComposerLive.Index do | |
use ExperimentsWeb, :live_view | |
import ExperimentsWeb.ComposerLive.Table | |
alias Experiments.Composers | |
alias Experiments.Composers.Composer | |
@impl true | |
def mount(_params, _session, socket) do |
I hereby claim:
To claim this, I am signing this object:
git ls-files | while read -r line; do | |
s=$(git status -s "$line"); | |
if [ -n "$s" ]; then | |
echo "$s"; | |
else | |
echo " $line"; | |
fi; | |
done |
defmodule Foo.SessionController do | |
use Foo.Web, :controller | |
def create(conn, %{"session" => session_params}) do | |
case Foo.Session.authenticate(session_params) do | |
{:ok, user} -> | |
{:ok, jwt, _full_claims} = Guardian.encode_and_sign(user, :token) | |
conn | |
|> put_status(:created) |
module Main (..) where | |
import Effects exposing (Effects, Never, none) | |
import Json.Decode as Json | |
import Html exposing (..) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
import String | |
import StartApp | |
import Signal exposing (Address) |
public void SetSortFunc(int sort_column_id, Gtk.TreeIterCompareFunc sort_func) { | |
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func); | |
IntPtr user_data; | |
GLib.DestroyNotify destroy; | |
if (sort_func == null) { | |
user_data = IntPtr.Zero; | |
destroy = null; | |
} else { | |
user_data = (IntPtr) GCHandle.Alloc (sort_func_wrapper); | |
destroy = GLib.DestroyHelper.NotifyHandler; |
# lib/mix/tasks/musikr.seed.ex | |
defmodule Mix.Tasks.Musikr.Seed do | |
use Mix.Task | |
@shortdoc "Seeds the database" | |
@moduledoc """ | |
Seed the database using the file 'priv/repo/seeds.exs' | |
""" |
# In production mode | |
2.1.0 :001 > p = { a: 1, b: 2, c: 3 } | |
=> {:a=>1, :b=>2, :c=>3} | |
2.1.0 :002 > params = ActionController::Parameters.new(p) | |
=> {"a"=>1, "b"=>2, "c"=>3} | |
2.1.0 :003 > params.permit(:a) | |
=> {"a"=>1} | |
2.1.0 :004 > | |
# In development mode |
public TreePath[] GetSelectedRows () | |
{ | |
IntPtr list_ptr = gtk_tree_selection_get_selected_rows (Handle, IntPtr.Zero); | |
if (list_ptr == IntPtr.Zero) | |
return new TreePath [0]; | |
GLib.List list = new GLib.List (list_ptr, typeof (Gtk.TreePath)); | |
TreePath[] paths = (TreePath[]) GLib.Marshaller.ListToArray (list, typeof (Gtk.TreePath)); | |
foreach (TreePath path in paths) { |