Skip to content

Instantly share code, notes, and snippets.

View greyblake's full-sized avatar
🇺🇦
#StandWithUkraine

Serhii Potapov greyblake

🇺🇦
#StandWithUkraine
View GitHub Profile
@fry
fry / sentry.rs
Created June 27, 2019 10:45
Sentry Setup in Dynamic Libraries
lazy_static! {
static ref GUARD: Mutex<Option<sentry::internals::ClientInitGuard>> = Mutex::new(None);
}
*GUARD.lock().unwrap() = Some(sentry::init(dotenv!("SENTRY_DSN")));
sentry::integrations::panic::register_panic_handler();
let next = panic::take_hook();
panic::set_hook(Box::new(move |info| {
@greyblake
greyblake / .travis.yml
Created September 15, 2018 14:40
Minimal rust setup for travis ci
language: rust
rust:
- stable
install:
- rustup component add rustfmt-preview
- rustup component add clippy-preview
script:
- cargo fmt -- --check
- touch ./src/main.rs && cargo clippy -- -D warnings
- cargo test

Looking into the Future

futures-rs is the library which will hopefully become a shared foundation for everything async in Rust. However it's already become renowned for having a steep learning curve, even for experienced Rustaceans.

I think one of the best ways to get comfortable with using a library is to look at how it works internally: often API design can seem bizarre or impenetrable and it's only when you put yourself in the shoes of the library author that you can really understand why it was designed that way.

In this post I'll try to put down on "paper" my understanding of how futures work and I'll aim to do it in a visual way. I'm going to assume you're already somewhat familiar with Rust and why futures are a useful tool to have at one's disposal.

For most of this post I'll be talking about how things work today (as of September 2017). At the end I'll touch on what's being proposed next and also make a case for some of the changes I'd like to see.

If you're interested in learning more ab

@carols10cents
carols10cents / ruby-to-rust-cheat-sheet.md
Last active November 24, 2020 23:12
Ruby to Rust Cheat Sheet

Ruby to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in Ruby and Rust so that programmers most comfortable with Ruby can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

Ruby:

@zekefast
zekefast / postgresql.conf
Last active December 31, 2022 19:04
PostgreSQL configuration tuning to improve tests performance of database interactions.
# PostgreSQL configuration tuning to improve tests performance of database interactions.
# Look for more detailed description in follow articles:
# - http://rhaas.blogspot.com/2010/06/postgresql-as-in-memory-only-database_24.html
#
# ATTENTION:
# Before appling those settings ensure that you have no important data in your cluster, because those settings
# could cause problems on your production database in case of appliance.
#
# Ensure follow settings have given values.
@staltz
staltz / introrx.md
Last active April 19, 2024 18:49
The introduction to Reactive Programming you've been missing
@Fivell
Fivell / pg_sp.sql
Last active August 29, 2015 13:57
pg sp exmple
# psql -U postgres
psql (9.3.4)
Type "help" for help.
postgres=# CREATE FUNCTION insert_city(character varying)
postgres-# RETURNS void AS
postgres-# $BODY$
postgres$# BEGIN
postgres$# INSERT INTO city("name") VALUES($1);
postgres$# END