Skip to content

Instantly share code, notes, and snippets.

if 1:
spam()
# comment
else:
eggs() # comment
This file has been truncated, but you can view the full file.
fn mtproto::<impl at clacks-mtproto/src/mtproto.rs:31629:1: 32915:2>::deserialize_boxed(_1: ConstructorNumber, _2: &mut Deserializer) -> std::result::Result<mtproto_prelude::TLObject, error::Error>{
let mut _0: std::result::Result<mtproto_prelude::TLObject, error::Error>; // return place
scope 1 {
let _4: ConstructorNumber; // "id" in scope 1 at clacks-mtproto/src/mtproto.rs:32912:13: 32912:15
}
scope 2 {
let _12: error::Error; // "err" in scope 2 at clacks-mtproto/src/mtproto.rs:32274:61: 32274:140
scope 4 {
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@habnabit
habnabit / playground.rs
Last active September 28, 2017 02:57 — forked from anonymous/playground.rs
Rust code shared from the playground
use linux;
use log;
use core::fmt::Write;
use core::fmt;
use log::{LogRecord, LogLevel, LogMetadata};
#[derive(Default)]
struct DMesgLogger;
for location in locations:
for mode in ['driving', 'transit']:
row = [place, mytime, mode]
for i in range(10):
mytime += timedelta(minutes=20)
row.append(get_directions(location, (lat,lon), mytime, mode, gmaps))
csv_file.writerow(row)
use sodiumoxide::crypto::box_::{SecretKey, PublicKey};
use typemap::TypeMap;
use std::sync::{Arc, RwLock};
use llsd::frames::{Frame, FrameKind};
use llsd::session::server::Session;
use llsd::session::Sendable;
use llsd::sessionstore::SessionStore;
use llsd::authenticator::Authenticator;
use errors::{AWResult, AWErrorKind};
@habnabit
habnabit / steps.sh
Created August 21, 2016 05:16
rust on emscripten
./emsdk update
./emsdk install emscripten-incoming-64bit
./emsdk activate emscripten-incoming-64bit
./emsdk install sdk-incoming-64bit
./emsdk activate sdk-incoming-64bit
# [...]
git clone -b emscripten https://github.com/habnabit/rust
cd rust
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
match event {
// Sample structure.
// Ok(Message(Standard { ts: "1465616511.000007", channel: Some("G0RFEFRF1"),
// user: Some("U04R67MSW"), text: Some("#sloakme"), is_starred: None,
// pinned_to: None, reactions: None, edited: None, attachments: None }))
Ok(&slack::Event::Message(slack::Message::Standard {
channel: Some(ref channel),
user: Some(ref user),
text: Some(ref text),
..
fn float_precision(v: f64, sig_figs: u32) -> usize {
let v = v.abs();
if v == 0f64 {
return 0;
}
let prec = (v.log10().floor() - (sig_figs as f64)) as isize + 1;
if prec >= 0 {
0
} else {
-prec as usize