Skip to content

Instantly share code, notes, and snippets.

View anandgeorge's full-sized avatar

Anand George anandgeorge

  • Storm Consulting
  • Mumbai, India
View GitHub Profile
@anandgeorge
anandgeorge / game.ex
Created July 16, 2021 07:59 — forked from andrewhao/game.ex
Dynamic Supervisors in Elixir
defmodule Game do
use GenServer
def init(game_id) do
{:ok, %{game_id: game_id}}
end
def start_link(game_id) do
GenServer.start_link(__MODULE__, game_id, name: {:global, "game:#{game_id}"})
end
@anandgeorge
anandgeorge / Elixir_Supervision_Trees.md
Created July 15, 2021 16:25 — forked from gkaemmer/Elixir_Supervision_Trees.md
Quick guide to creating Elixir supervision trees from scratch

Elixir Supervision Trees Made Easy

I started with Elixir just a couple weeks after the switch from 1.4 to 1.5, so the bulk of online resources were out of date (or at least resulted in deprecation warnings). This guide is for defining Elixir 1.5 supervised modules.

It's not actually terribly complicated. It's just sometimes unclear from examples what's implemented by the language and what you actually have to implement yourself.

Say we want a supervision tree like this (where each atom is a process):

    :a

/ \

@anandgeorge
anandgeorge / elixir_notes.md
Created June 14, 2021 07:57 — forked from fschuindt/elixir_notes.md
My personal study notes on Elixir. It's basically a resume of http://elixir-lang.org/getting-started/ (Almost everything is copied). Still working on it!
@anandgeorge
anandgeorge / README.md
Created March 13, 2012 11:17 — forked from bergie/README.md
Falsy Values tutorials
@anandgeorge
anandgeorge / mouse.js
Created March 12, 2012 14:57 — forked from bfncs/mouse.js
Read Linux mouse(s) in node.js
/**
* Read Linux mouse(s) in node.js
* Author: Marc Loehe (marcloehe@gmail.com)
*
* Adapted from Tim Caswell's nice solution to read a linux joystick
* http://nodebits.org/linux-joystick
* https://github.com/nodebits/linux-joystick
*/
var fs = require('fs'),
@anandgeorge
anandgeorge / impartialoutsider.coffee
Created March 12, 2012 04:10 — forked from chrissharkey/impartialoutsider.coffee
Pizza voting IRC bot in Node.js
#!/usr/bin/env node
CHANNEL = '#bozler'
MINIMUM_HUMAN_REACTION = 2
DIALOGUE =
ACTIONS_IN_REPLY: [
"I vote for pizza",
"Disregard that, I vote for pizza",
"Another vote for pizza!"