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
# Copyright (c) 2017 Cary Kempston | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in all |
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
def processes_by_type() do | |
procs = Enum.reduce(:erlang.processes(), %{}, fn(pid, acc) -> | |
initial_call = case :erlang.process_info(pid, :initial_call) do | |
{:initial_call, {:proc_lib, :init_p, a}} -> | |
case :erlang.process_info(pid, :dictionary) do | |
{:dictionary, d} -> | |
Keyword.get(d, :"$initial_call") | |
_ -> | |
{:proc_lib, :init_p, a} | |
end |
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
defmodule CodeReloaderWorker do | |
use GenServer | |
require Logger | |
def start_link do | |
GenServer.start_link __MODULE__, [], name: __MODULE__ | |
end | |
def init([]) do | |
Logger.debug "#{__MODULE__} starting" |
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
-spec riakc_action(Action::put|get|delete|get_index|mapred|search, RiakcArgs::list()) -> term(). | |
riakc_action(Action, RiakcArgs) -> | |
riakc_action(Action, RiakcArgs, 0). | |
riakc_action(_Action, _RiakcArgs, Tries) when Tries > 16 -> | |
{error, disconnected}; | |
riakc_action(Action, RiakcArgs, Tries) -> | |
RiakcPid = poolboy:checkout(wsdb_riakc_pool), | |
try apply(riakc_pb_socket, Action, [RiakcPid|RiakcArgs]) of | |
{error, disconnected} -> |
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
-module(pinger). | |
-behaviour(gen_server). | |
%% API | |
-export([start_link/1, pong/0]). | |
%% gen_server callbacks | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, | |
terminate/2, code_change/3]). |
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
# -*- coding: utf-8 -*- | |
# Copyright (c) 2010 Metin Akat | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# |
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
// Step 1. global definition | |
function Map(config) { | |
this._init(config); | |
} | |
Map.prototype = { | |
_container: null, | |
_init: function (config) { | |
this._container = document.getElementById(config.container); |