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
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) |
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
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}; |
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
./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 |
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
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, |
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
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), | |
.. |
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
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 |
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
use std::collections::VecDeque; | |
use std::sync::mpsc; | |
pub struct BipBufferReader<'a> { | |
incoming: mpsc::Receiver<&'a mut [u8]>, | |
ready: VecDeque<&'a mut [u8]>, | |
outgoing: mpsc::Sender<&'a mut [u8]>, | |
} | |
impl<'a> BipBufferReader<'a> { |
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
# 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, |
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
trait FlattenResultsIterator: Itertools { | |
fn flatten_results<A, E, I>(&mut self) -> Result<Box<Iterator<Item=I>>, E> | |
where Self: Sized + Iterator<Item=Result<A, E>>, | |
A: 'static + IntoIterator<Item=I>, | |
I: 'static, | |
{ | |
self.fold_results( | |
Box::new(iter::empty::<I>()) as Box<Iterator<Item=I>>, | |
|accum, it| Box::new(accum.chain(it)) as Box<Iterator<Item=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
// https://www.youtube.com/watch?v=kZRFlgV5KVU | |
#![crate_type="staticlib"] | |
#![no_std] | |
#[macro_use] | |
extern crate pebble; | |
use pebble::Layer; |