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
王 | |
江 | |
周 | |
胡 | |
刘 | |
李 | |
吴 | |
毛 | |
温 | |
习 |
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
def foo | |
111 | |
rescue | |
222 | |
ensure | |
333 | |
end | |
puts foo # got 111 |
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
require 'sinatra' | |
require 'action_mailer' | |
class Mailer < ActionMailer::Base | |
def contact | |
mail( | |
:to => "[email protected]", | |
:from => "[email protected]", | |
:subject => "Test") do |format| | |
format.text |
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(multi_try). | |
-export([dothese/1]). | |
dothese(FuncArray) -> | |
Me = self(), | |
lists:foreach(fun(F) -> spawn(fun() -> F(Me) end) end, FuncArray), | |
spawn(fun() -> timer:sleep(200), Me ! timeout end), | |
Result = get_result("",length(FuncArray)), | |
io:format("result: ~p~n", [Result]). |