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
-module(stopwatch_client). | |
-export([start_timer/0, stop_timer/0, read_timer/0]). | |
start_timer() -> | |
stopwatch_server ! {self(), start_timer}. | |
stop_timer() -> | |
stopwatch_server ! {self(), stop_timer}. |
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
-module(stopwatch). | |
-behaviour(gen_server). | |
%% Server API | |
-export([start_link/0, stop/0]). | |
%% Client API | |
-export([start_timer/0, stop_timer/0, read_timer/0]). | |
%% gen_server callbacks |
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
-module(echo_server). | |
-behaviour(gen_server). | |
%% Server API | |
-export([start_link/3, stop/1]). | |
%% Client API | |
-export([echo/1, assassinate/1]). | |
%% gen_server callbacks |
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
-module(echo_supervisor). | |
-behaviour(supervisor). | |
%% API | |
-export([start_link/0]). | |
%% Supervisor callbacks | |
-export([init/1]). | |
-define(SERVER, ?MODULE). |
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
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..")) | |
$:.unshift File.join(ROOT_PATH, "vendor", "dropbox-ruby-sdk", "lib") | |
require "dropbox_sdk" | |
require "fileutils" | |
app_key = ENV["DROPBOX_APP_KEY"] | |
app_secret = ENV["DROPBOX_APP_SECRET"] | |
auth_key = ENV["DROPBOX_AUTH_KEY"] | |
auth_secret = ENV["DROPBOX_AUTH_SECRET"] |
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
$ ruby simple_operation.rb | |
Creating /tmp/hello840: (data) | |
Fetching metadata for /tmp/hello840: (data) | |
Uploading /tmp/hello840/tmp.rb: (data) | |
Fetching metadata for /tmp/hello840/tmp.rb: (data) | |
Uploading /tmp/hello840/tmp.rb: (data) | |
Fetching metadata for /tmp/hello840/tmp.rb: (data) | |
Uploading /tmp/hello840/tmp.rb: (data) | |
Fetching metadata for /tmp/hello840/tmp.rb: (data) | |
Fetching metadata for /tmp/hello840: (data) |
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
$ ruby simple_operation.rb | |
Creating /tmp/hello446: (data) (404ms) | |
Fetching metadata for /tmp/hello446: (data) (230ms) | |
Uploading /tmp/hello446/tmp.rb: (data) (914ms) | |
Fetching metadata for /tmp/hello446/tmp.rb: (data) (298ms) | |
Uploading /tmp/hello446/tmp.rb: (data) (860ms) | |
Fetching metadata for /tmp/hello446/tmp.rb: (data) (259ms) | |
Uploading /tmp/hello446/tmp.rb: (data) (922ms) | |
Fetching metadata for /tmp/hello446/tmp.rb: (data) (234ms) | |
Fetching metadata for /tmp/hello446: (data) (250ms) |
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
$ ruby simple_operation.rb | |
Creating /tmp/hello185: (data) (2622ms) | |
Fetching metadata for /tmp/hello185: (data) (1229ms) | |
Uploading /tmp/hello185/tmp.rb: (data) (4120ms) | |
Fetching metadata for /tmp/hello185/tmp.rb: (data) (1308ms) | |
Uploading /tmp/hello185/tmp.rb: (data) (3409ms) | |
Fetching metadata for /tmp/hello185/tmp.rb: (data) (1254ms) | |
Uploading /tmp/hello185/tmp.rb: (data) (5276ms) | |
Fetching metadata for /tmp/hello185/tmp.rb: (data) (1028ms) | |
Fetching metadata for /tmp/hello185: (data) (1386ms) |
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
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..")) | |
$:.unshift File.join(ROOT_PATH, "vendor", "dropbox-ruby-sdk", "lib") | |
require "dropbox_sdk" | |
require "fileutils" | |
app_key = ENV["DROPBOX_APP_KEY"] | |
app_secret = ENV["DROPBOX_APP_SECRET"] | |
auth_key = ENV["DROPBOX_AUTH_KEY"] | |
auth_secret = ENV["DROPBOX_AUTH_SECRET"] |
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
var WebSocketServer = require('ws').Server | |
, wss = new WebSocketServer({port: 8088}) | |
, _ = require("underscore"); | |
var connections = []; | |
wss.on('connection', function(ws) { | |
connections.push(ws); | |
ws.on('message', function(message) { | |
console.log('received: %s', message); |
OlderNewer