Skip to content

Instantly share code, notes, and snippets.

@menzel
menzel / raincloud.py
Created March 30, 2023 09:12
python raincloud plot using seaborn and matplotlib
import pandas as pd
import matplotlib
matplotlib.use('tkagg')
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import colors
from scipy.stats import ranksums
@menzel
menzel / estimatewatt.R
Last active August 3, 2022 21:50
Golden Cheetah Watt estimator R script
ride <- GC.activity(compare=FALSE)
estimatew <- function(speed, wind_speed, slope,alt){
hoodsA = 0.324
dropsA = 0.307
aerobarsA = 0.2914
speed = speed/3.6
chr1 16999 169991
chr1 19704 197041
chr1 667239 6672391
chr1 669329 6693291
chr1 670303 6703031
chr1 672208 6722081
chr1 675888 6758881
chr1 773213 7732131
chr1 776300 7763001
chr1 781936 7819361
Prefix Verb URI Pattern Controller#Action
line_items GET /line_items(.:format) line_items#index
POST /line_items(.:format) line_items#create
new_line_item GET /line_items/new(.:format) line_items#new
edit_line_item GET /line_items/:id/edit(.:format) line_items#edit
line_item GET /line_items/:id(.:format) line_items#show
PATCH /line_items/:id(.:format) line_items#update
PUT /line_items/:id(.:format) line_items#update
DELETE /line_items/:id(.:format) line_items#destroy
carts GET /carts(.:format) carts#index
26 # POST /line_items
27 # POST /line_items.json
28 def create
29 product = Product.find(params[:product_id])
30 @line_item = @cart.add_product(product.id)
31
32 respond_to do |format|
33 if @line_item.save
34 format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }
35 format.json { render action: 'show', status: :created, location: @line_item }
app/views/carts/show.html.erb:
<% @cart.line_items.each do |item| %>
<li><%= item.quantity %> &times; <%= item.product.title %></li>
<% end %>
------------------------------------------