Skip to content

Instantly share code, notes, and snippets.

View wccrawford's full-sized avatar

William Crawford wccrawford

  • Central Florida
View GitHub Profile
@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})")
)
@josephwecker
josephwecker / new_bashrc.sh
Created August 11, 2012 04:36
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@Nitrousoxide
Nitrousoxide / lemmyfollowbookmarklet
Last active June 29, 2023 09:02
Lemmy Follow Bookmarklet
javascript:(function() {
var currentUrl = window.location.href;
var instanceUrl = 'https://beehaw.org'; /*replace this with your local instance's URL with no ending '/' */
var communitySlug = currentUrl.split('/c/')[1];
var originalUrl = currentUrl.split('/')[2];
var subscribeUrl = instanceUrl + '/c/' + communitySlug + '@' + originalUrl;
window.location.href = subscribeUrl;
})();