Skip to content

Instantly share code, notes, and snippets.

View zzal's full-sized avatar

Alain Duchesneau zzal

  • Québec / Canada
View GitHub Profile
@bguiz
bguiz / svg-9slice-scaling.svg
Created January 20, 2015 05:18
svg 9-slice scaling - +chrome + firefox -ie
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jimjeffers
jimjeffers / html5VideoAspectRatioAdjustment.coffee
Created September 15, 2011 13:24
Breaking the HTML5 Video Aspect Ratio
# Just an example.
# @video is a direct reference to a '<video>' element.
# $() is assuming jQuery is being used in this example.
@video.addEventListener("loadedmetadata", (event) =>
actualRatio = @video.videoWidth/@video.videoHeight
targetRatio = $(@video).width()/$(@video).height()
adjustmentRatio = targetRatio/actualRatio
$(@video).css("-webkit-transform","scaleX(#{adjustmentRatio})")
)