Skip to content

Instantly share code, notes, and snippets.

View bolmaster2's full-sized avatar

Joel Larsson bolmaster2

View GitHub Profile
@bolmaster2
bolmaster2 / is_el_in_view.js
Created September 7, 2011 07:52
Is element in view? A cross-browser way to check if a specific element is in viewport
// check if el is in view
function is_el_in_view(el, full_el_visible) {
if (!el) return false;
// should we return true if the element is only partially visible (default)
full_el_visible = typeof full_el_visible != "undefined" ? full_el_visible : false;
var el_pos = get_absolute_offset(el),
el_h = el.offsetHeight,
window_h = window.innerHeight || document.documentElement.clientHeight,
@bolmaster2
bolmaster2 / gist:966118
Last active September 25, 2015 18:37
FTP upload of files
#!/bin/bash
HOST=""
USER=""
PASS=""
LCD="./"
RCD="/path/to/remote/"
lftp -e "mirror --reverse \
--delete \
--verbose \
@bolmaster2
bolmaster2 / deploy.sh
Last active August 13, 2017 16:23
Deploy script using rsync and ssh to upload your local files
#!/bin/sh
# server settings
SERVER="user@server.com"
SERVER_PATH="/var/www/project"
SSH_PORT="2222"
# sync with some standard exclude paths
rsync -rav -e "ssh -p $SSH_PORT" \
--exclude='*.git' \