Skip to content

Instantly share code, notes, and snippets.

// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@psymeon
psymeon / inViewport.js
Created September 3, 2014 12:40
Simple jQuery function that determines whether DOM element is in the browser's viewport.
// Custom jQuery function.
// Determines if element is withing the viewport.
$.fn.inViewport = function() {
$el = this;
var elTop = $el.offset().top;
var elBot = elTop + $el.outerHeight(true);
var winScrollTop = $(window).scrollTop();
var winHeight = $(window).height();
var inViewport = winScrollTop <= elBot && (winScrollTop + winHeight) >= elTop;
return inViewport;