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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var stopwatch = new Stopwatch(); | |
stopwatch.Start(); | |
UploadToBlobAsync().Wait(); | |
stopwatch.Stop(); | |
Debug.WriteLine("Elapsed time in seconds: " + stopwatch.ElapsedMilliseconds / 1000); | |
} |
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
public class SmtpClientWrapper : IDisposable | |
{ | |
private SmtpClient _smtpClient; | |
public SmtpClientWrapper(SmtpClient smtpClient) | |
{ | |
this._smtpClient = smtpClient; | |
} | |
public async Task SendMailAsync(MailMessage message, CancellationToken ct) |
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
public async Task SendMailAsync(MailMessage message, CancellationToken ct) | |
{ | |
try | |
{ | |
var task = _smtpClient.SendMailAsync(message); | |
using (ct.Register(_smtpClient.SendAsyncCancel)) | |
{ | |
try | |
{ | |
await task; |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var stopwatch = new Stopwatch(); | |
stopwatch.Start(); | |
UploadToBlobAsync().Wait(); | |
stopwatch.Stop(); | |
Debug.WriteLine("Elapsed time in seconds: " + stopwatch.ElapsedMilliseconds / 1000); | |
} |
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
const once = (fun, timeoutInMilliseconds) => { | |
let inProgress = false; | |
setTimeout(() => { | |
inProgress = false; | |
}, timeoutInMilliseconds); | |
return () => { | |
if (inProgress) { | |
return; |
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
let pipe = (value, ...funs) => { | |
return funs.reduce((accumulator, currentFun) => currentFun(accumulator), value); | |
} | |
let add1 = x => x + 1; | |
let multiply2 = x => x * 2; | |
pipe(10, add1, add1, multiply2, console.log); |
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
const RomanNumerals = { | |
1000: 'M', | |
500: 'D', | |
100: 'C', | |
50: 'L', | |
10: 'X', | |
5: 'V', | |
1: 'I' | |
}; |
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
function once(fn) { | |
let done = false; | |
return function(...args) { | |
if (done) { | |
return void 0; | |
} | |
done = true; | |
return fn.apply(this, args); |
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
function mapWith (fn) { | |
return (list) => { | |
return Array.prototype.map.call( | |
list, | |
(value) => fn.call(this, value)) | |
} | |
} |
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
function unary(fn) { | |
return (value) => fn.call(this, value); | |
} |
OlderNewer