Skip to content

Instantly share code, notes, and snippets.

@eightdot2
Created September 1, 2025 13:03
Show Gist options
  • Select an option

  • Save eightdot2/ccc41acddf21445eaa1120c11c422436 to your computer and use it in GitHub Desktop.

Select an option

Save eightdot2/ccc41acddf21445eaa1120c11c422436 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Single Speed Gear Ratio Chart</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 20px;
background-color: #f8f9fa;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}
h1 {
color: #2c3e50;
text-align: center;
margin-bottom: 10px;
font-size: 24px;
}
.subtitle {
text-align: center;
color: #7f8c8d;
margin-bottom: 20px;
font-style: italic;
}
.legend {
display: flex;
justify-content: center;
gap: 30px;
margin-bottom: 20px;
font-size: 14px;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
}
.legend-color {
width: 16px;
height: 16px;
border-radius: 3px;
}
.easy { background-color: #d4edda; }
.medium { background-color: #fff3cd; }
.hard { background-color: #f8d7da; }
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
font-size: 11px;
}
th, td {
border: 1px solid #ddd;
padding: 6px;
text-align: center;
}
th {
background-color: #34495e;
color: white;
font-weight: bold;
font-size: 12px;
}
.sprocket-header {
background-color: #2c3e50;
writing-mode: vertical-rl;
text-orientation: mixed;
width: 35px;
font-size: 11px;
}
.chainring-header {
background-color: #2c3e50;
font-size: 10px;
min-width: 35px;
}
td {
background-color: white;
transition: background-color 0.2s;
}
td:hover {
background-color: #3498db;
color: white;
cursor: pointer;
transform: scale(1.05);
font-weight: bold;
}
/* Colour coding for gear ratios */
.ratio-easy { background-color: #d4edda; }
.ratio-medium { background-color: #fff3cd; }
.ratio-hard { background-color: #f8d7da; }
.notes {
margin-top: 30px;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
border-left: 4px solid #3498db;
}
.notes h3 {
color: #2c3e50;
margin-top: 0;
}
.notes ul {
margin: 10px 0;
padding-left: 20px;
}
.notes li {
margin-bottom: 8px;
line-height: 1.4;
}
.gear-guide {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
margin-top: 20px;
}
.gear-category {
padding: 15px;
border-radius: 8px;
text-align: center;
}
.gear-category h4 {
margin-top: 0;
font-size: 16px;
}
</style>
</head>
<body>
<div class="container">
<h1>Single Speed Gear Ratio Chart</h1>
<div class="subtitle">Comprehensive ratio table for 14t-21t sprockets and 30t-55t chainrings</div>
<div class="legend">
<div class="legend-item">
<div class="legend-color easy"></div>
<span>Easy gearing (≀2.0) - Hills & starting</span>
</div>
<div class="legend-item">
<div class="legend-color medium"></div>
<span>Medium gearing (2.0-2.8) - General riding</span>
</div>
<div class="legend-item">
<div class="legend-color hard"></div>
<span>Hard gearing (β‰₯2.8) - Speed & flats</span>
</div>
</div>
<table>
<thead>
<tr>
<th class="sprocket-header">Sprocket<br/>Teeth</th>
<th class="chainring-header">30t</th>
<th class="chainring-header">32t</th>
<th class="chainring-header">34t</th>
<th class="chainring-header">36t</th>
<th class="chainring-header">38t</th>
<th class="chainring-header">40t</th>
<th class="chainring-header">42t</th>
<th class="chainring-header">44t</th>
<th class="chainring-header">46t</th>
<th class="chainring-header">48t</th>
<th class="chainring-header">50t</th>
<th class="chainring-header">52t</th>
<th class="chainring-header">55t</th>
</tr>
</thead>
<tbody id="gearTable">
</tbody>
</table>
<div class="gear-guide">
<div class="gear-category easy">
<h4>🟒 Easy Gearing (≀2.0)</h4>
<p>Perfect for hills, starting from stops, and loaded touring. Requires more pedalling for speed but much easier on the legs.</p>
</div>
<div class="gear-category medium">
<h4>🟑 Medium Gearing (2.0-2.8)</h4>
<p>Ideal for most urban commuting and mixed terrain. Good balance between climbing ability and top speed.</p>
</div>
<div class="gear-category hard">
<h4>πŸ”΄ Hard Gearing (β‰₯2.8)</h4>
<p>Best for flat terrain, racing, and maximum speed. More challenging for hills but excellent for maintaining high speeds.</p>
</div>
</div>
<div class="notes">
<h3>πŸš΄β€β™‚οΈ Gear Selection Guide for Your London Commute:</h3>
<ul>
<li><strong>For Peckham to West London commuting:</strong> Consider 36t/18t (2.0) or 38t/18t (2.11) - good balance for London's mixed terrain</li>
<li><strong>If you prefer easier starts:</strong> Try 34t/18t (1.89) or 36t/19t (1.89)</li>
<li><strong>For more speed on flats:</strong> Consider 42t/16t (2.63) or 44t/16t (2.75)</li>
<li><strong>Popular starting point:</strong> 32t/19t (1.68) - very manageable for beginners</li>
<li><strong>Road racing equivalent:</strong> 48t/16t (3.0) - for experienced riders wanting speed</li>
</ul>
<h3>πŸ’‘ Key Tips:</h3>
<ul>
<li>Hover over any cell to highlight the ratio and see it enlarged</li>
<li>Lower ratios = easier pedalling, better for hills, lower top speed</li>
<li>Higher ratios = harder pedalling, better for speed, tougher on hills</li>
<li>Consider your fitness level, terrain, and riding style when choosing</li>
<li>You can always experiment with different sprockets (cheaper than changing chainrings)</li>
</ul>
</div>
</div>
<script>
function calculateRatio(chainring, sprocket) {
return (chainring / sprocket).toFixed(2);
}
function getRatioClass(ratio) {
if (ratio <= 2.0) return 'ratio-easy';
if (ratio <= 2.8) return 'ratio-medium';
return 'ratio-hard';
}
// Generate the table
const tableBody = document.getElementById('gearTable');
const chainrings = [30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 55];
for (let sprocket = 14; sprocket <= 21; sprocket++) {
const row = document.createElement('tr');
// Sprocket header
const sprocketHeader = document.createElement('th');
sprocketHeader.textContent = sprocket + 't';
sprocketHeader.className = 'sprocket-header';
row.appendChild(sprocketHeader);
// Calculate ratios for each chainring
chainrings.forEach(chainring => {
const cell = document.createElement('td');
const ratio = calculateRatio(chainring, sprocket);
cell.textContent = ratio;
cell.className = getRatioClass(parseFloat(ratio));
cell.title = `${chainring}t/${sprocket}t = ${ratio}:1 ratio`;
row.appendChild(cell);
});
tableBody.appendChild(row);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment