Skip to content

Instantly share code, notes, and snippets.

View atandy's full-sized avatar
🌴
On vacation

Tandy atandy

🌴
On vacation
  • NYC
View GitHub Profile
<script>
// https://stackoverflow.com/questions/64689086/infinite-counter-with-increment-at-two-decimals
function Incro(increment, interval, execFunc){
let iv;
this.increment = increment; this.interval = interval; this.execFunc = execFunc; this.sum = 0;
this.start = ()=>{
iv = setInterval(()=>{
this.sum += this.increment; this.execFunc();
}, this.interval);
return this;
@atandy
atandy / calculate_estimate.py
Created February 7, 2019 22:10
Example of an estimation calculator for Transferwise transfers
def calculate_delivery_estimate(todays_date, current_weekday):
'''Calculates a delivery estimate based on today's date and day of week'''
# average time in minutes that it took for a transfer complete
# when it was created on that day of the week
# this data only represents Payment Type A in a single currency_corridor.
# it also already has total transfer time delivery outliers removed.
weekday_delivery_avg_minutes = {
'Fri': 5677.73,
'Mon': 2918.34,
@atandy
atandy / index.html
Last active June 1, 2017 13:55
Rendering CSV
<HTML>
<body>
{{table}}
</body>
</HTML>
from sqlalchemy import create_engine
engine = create_engine('mysql://username:password@hostname:port/database_name')
dataframe.to_sql('table_name', con=engine, flavor='mysql', if_exists='append', index=False)