Skip to content

Instantly share code, notes, and snippets.

@jbmerand
jbmerand / gist:1ca8b125e67437222aab63e6ab3569d5
Created August 2, 2019 10:20 — forked from ishikawa/gist:88599
Java Sample Code for Calculating HMAC-SHA1 Signatures
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Formatter;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
@jbmerand
jbmerand / isElementInViewport.js
Created December 2, 2018 14:59 — forked from davidtheclark/isElementInViewport.js
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&