Skip to content

Instantly share code, notes, and snippets.

@jaw-sh
jaw-sh / cloudflare.sh
Last active October 17, 2020 08:29
Bash file to pull Cloudflare IPs from their API endpoints. Can be used in CRON jobs.
#!/bin/bash
# Author: Joshua Moon <josh@jaw.sh>
# Date: 14-May-2016
# Purpose: Creates an up-to-date Cloudflare nginx config file.
# License: MIT
################################################################################
# INSTRUCTIONS
@jaw-sh
jaw-sh / gist:2dd0eb3be4c0845813e4
Last active October 17, 2020 10:50
NGINX catch-all for redirecting www and http to non-www https
# Redirect http:// to https://
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
# Redirect https://www to https://
@EvanHerman
EvanHerman / check-if-element-in-viewport-on-scroll.js
Last active December 20, 2024 14:34
Check when an element comes into view (jQuery)
function isOnScreen(elem) {
// if the element doesn't exist, abort
if( elem.length == 0 ) {
return;
}
var $window = jQuery(window)
var viewport_top = $window.scrollTop()
var viewport_height = $window.height()
var viewport_bottom = viewport_top + viewport_height
var $elem = jQuery(elem)
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active October 7, 2026 18:10
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04