Skip to content

Instantly share code, notes, and snippets.

@blup blup/ramda-test.coffee Secret
Created Jul 29, 2015

Embed
What would you like to do?
pct = R.compose(R.divide(R.__, max-min), R.subtract(R.__, min))
left = R.compose(R.multiply(ui.background.offsetWidth-ui.handle.offsetWidth), pct)
pctFormatted = R.compose(R.concat(R.__, '%'), R.multiply(100), pct)
leftFormatted = R.compose(R.concat(R.__, 'px'), left)
ui.foreground.style.width = pctFormatted(val)
ui.handle.style.left = leftFormatted(val)
# vs
pct = (val-min) / (max-min)
left = pct * (ui.background.offsetWidth-ui.handle.offsetWidth)
ui.foreground.style.width = (pct*100) + '%'
ui.handle.style.left = left + 'px'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.