Skip to content

Instantly share code, notes, and snippets.

View nanne007's full-sized avatar
🏠
Working from home

caojiafeng nanne007

🏠
Working from home
View GitHub Profile
@bmwill
bmwill / futures03_async_await.md
Created August 21, 2019 21:34
Futures 0.3 and Async/Await

OUTDATED

Futures 0.3 and Async/Await

This document will try to give a short tutorial of how to use the new style futures (0.3), how to use Async/Await, and how to use the compatibility layer to interoperate with old futures (0.1) and tokio.

Terminology

When dealing with futures in this new world there are a lot of different parts and it can be difficult to keep things straight at times. As such here is a quick run down of the different parts and what they are.

@Matthias247
Matthias247 / async_await_cancellation.md
Created May 28, 2019 06:09
Async/Await - The challenges besides syntax - Cancellation

Async/Await - The challenges besides syntax - Cancellation

This is the second article in a series of articles around Rusts new async/await feature. The first article about interfaces can be found here.

In this part of the series we want to a look at a mechanism which behaves very different in Rust than in all other languages which feature async/await support. This mechanism is Cancellation.

@HenningTimm
HenningTimm / rust_mem_profiling.md
Last active May 4, 2024 03:48
Memory profiling Rust code with heaptrack in 2019
@rfikki
rfikki / goerli-peers-latest.txt
Last active January 7, 2023 07:03
Goerli Peers 02/25/2021 - IMPORTANT RUN THE LATEST RELEASE OF THE GETH CLIENT - https://geth.ethereum.org/downloads/
admin.addPeer("enode://bfb8f20e0bda834faecdca1a01de66b9a7fc184c2a30fca681e6e018aaae91db5d80021f9bf9b5ab598c06264b97a7e1dac1068d16267573c033245b62a2f1f7@47.103.147.67:30303");
admin.addPeer("enode://4d0f2ee1d123159525e4a98fb698076469099d326fe60499ec886e3864fbcc71d3f7b9003fa122058883d6924444bebcfc6bb18b6eb7010cc11571e9ab8ea45b@51.158.104.10:30303");
admin.addPeer("enode://40c212f40b6912dffe848e5c97987e527a3f6da8305a05de2d59cf9444a2d5e183bbb18fab95a7b7e5dc8fa7c30dad0f30f22d39bcdf22c97a1c5ae1fc0f2986@54.175.52.44:30303");
admin.addPeer("enode://26800845069faba9791520112350d0a5f0cd52d0af890196beeb5195345e17b00e60e27f260f6e24087e6066c2637e210f389a9795360b1251c17e58b95446f9@85.25.137.11:30303");
admin.addPeer("enode://2daaae5f69037e575fe169d64aa668223effdf60c2a1898492bf0a9bd45d4991355431ec5bcf9cba2eed1d750cd425d689e0e5cc7141f2954623e3d233ad44ed@80.221.111.50:30303");
admin.addPeer("enode://7a3041767f5bb2f96edf824b186ddb97fdff074675dd55f71347da3b7586210a6e09507415291d2c952dd34184b33562f9a4ecb0188ce3781df644e69901f660
@kestein
kestein / Private_Crates.md
Last active March 28, 2024 10:36
Linking to a private repo in Cargo.toml

Under the dependencies section, put

<crate name>={git="ssh://git@github.com/<organization>/<reponame>.git"}

It is pretty similar to a github repo's ssh cloning link, however the : is replaced with a / and ssh:// is prepended to the URL.

git@github.com:my-organization/my-repo.git vs ssh://git@github.com/my-organization/my-repo.git

The SSH URL needs to be used because Cargo is currently unable to handle the authentication prompt that comes up when an HTTPS link is used.
Make sure that the matches the crate name in the target repo's Cargo.toml. The repo name will not override what is in the Cargo.toml if it is a different value.

@lattner
lattner / TaskConcurrencyManifesto.md
Last active July 21, 2024 05:08
Swift Concurrency Manifesto
@henrik
henrik / regex_case.exs
Last active September 21, 2022 03:06
Proof-of-concept of an Elixir construct like `case` but that matches strings against regexps. #elixirlang
defmodule RegexCase do
defmacro regex_case(string, do: lines) do
new_lines = Enum.map lines, fn ({:->, context, [[regex], result]}) ->
condition = quote do: String.match?(unquote(string), unquote(regex))
{:->, context, [[condition], result]}
end
# Base case if nothing matches; "cond" complains otherwise.
base_case = quote do: (true -> nil)
new_lines = new_lines ++ base_case
@CMCDragonkai
CMCDragonkai / higher_kinded_types_in_rust_and_haskell.md
Last active July 10, 2024 12:38
Rust/Haskell: Higher-Kinded Types (HKT)

Rust/Haskell: Higher-Kinded Types (HKT)

A higher kinded type is a concept that reifies a type constructor as an actual type.

A type constructor can be thought of in these analogies:

  • like a function in the type universe
  • as a type with a "hole" in it
@pixeltrix
pixeltrix / time_vs_datatime.md
Last active February 18, 2024 19:20
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).