Skip to content

Instantly share code, notes, and snippets.

View randomradio's full-sized avatar
🎯
Focusing

i.an randomradio

🎯
Focusing
View GitHub Profile

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@randomradio
randomradio / maps.utils.js
Last active June 27, 2017 20:15 — forked from joseadrian/maps.utils.js
Google Maps. Detect if one of the points on the polyline paths intersects a circle
(function(){
var polyline = new google.maps.Polyline();
google.maps.Polyline.prototype.closestDistanceToSegment = function(center, segment)
{
var firstPoint, lastPoint, A, B, C, D, E, distanceAB, t, projection = this.getMap().getProjection();
// The other extreme of the path
lastPoint = segment[0];
@randomradio
randomradio / .tmux.conf
Last active December 14, 2015 18:46 — forked from snuggs/.tmux.conf
TMUX configuration file
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
#
# COPY AND PASTE
@randomradio
randomradio / sublime-text-3-setup.md
Created March 30, 2017 17:24 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@randomradio
randomradio / gist:ccdfc55ddffbaf022f9d0c34f2760b3e
Created August 10, 2017 16:39 — forked from GrahamDumpleton/gist:b380652b768e81a7f60c
Setting environment variables for Apache/mod_wsgi hosted Python application.

Django documentation says to use:

WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com

<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted
@randomradio
randomradio / nginx.conf
Created May 30, 2023 07:27 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@randomradio
randomradio / nginx.conf
Created May 30, 2023 07:27 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration