Skip to content

Instantly share code, notes, and snippets.

jstrong-tios

Block or report user

Report or block jstrong-tios

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jstrong-tios
jstrong-tios / dthr.rs
Last active Nov 22, 2019
hourly/daily integer wrapper types
View dthr.rs
use std::fmt::{self, Debug, Display};
use std::convert::TryFrom;
use chrono::{NaiveDate, NaiveTime, NaiveDateTime, Timelike};
/// Represents number of hours since 1970
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone,
Hash, Copy, Serialize, Deserialize)]
pub struct DtHr(pub i32);
/// Represents number of days since 1970. Note: will break on June 6, 2149
@jstrong-tios
jstrong-tios / async-throttle.rb
Created May 1, 2019
bare-bones example with concurrent-ruby gem of async io with limiting in flight requests to an arbitrary size
View async-throttle.rb
#!/usr/bin/env ruby
require 'json'
require 'date'
require 'http'
require 'concurrent'
# I could not get bundle to install the 'concurrent-edge' gem so I just
# grabbed a couple classes I needed. code for Concurrent::Throttle is here:
# https://github.com/ruby-concurrency/concurrent-ruby/blob/master/lib-edge/concurrent/edge/throttle.rb
You can’t perform that action at this time.