Skip to content

Instantly share code, notes, and snippets.

View philfreo's full-sized avatar

Phil Freo philfreo

View GitHub Profile
@philfreo
philfreo / listening.sh
Created August 31, 2015 04:59
See what local processes are listening on any IP address
netstat -na | grep LISTEN | grep -v 127.0.0.1 | grep -v ::1
@philfreo
philfreo / guide.md
Created August 4, 2015 23:35
Close.io API Getting Started Guide

Getting Started with the Close.io API

The Close.io API allows you to connect your app or service directly to your data in Close.io to search your existing leads, add new leads, and much more. In this guide, we're going to look at a couple of examples of how to accomplish some basic tasks using the API so that you can get started integrating Close.io into your current apps and workflows.

General API Information

Base URL

https://app.close.io/api/v1
@philfreo
philfreo / README.md
Last active August 8, 2016 02:29
SSL CSR & localhost self-signing

Generate a CSR for production use:

openssl req -nodes -newkey rsa:2048 -sha256 -keyout mysite-ssl.private-key.pem -out mysite-ssl.csr -subj '/C=US/ST=California/L=Palo Alto/O=My Company Inc./CN=*.example.com'

Generate a long-lasting self-signed cert & trust it for localhost development usage:

openssl req -nodes -newkey rsa:2048 -sha256 -x509 -days 3650 -keyout selfsigned.key -out selfsigned.crt -subj '/C=US/ST=Anywhere/L=Anywhere/O=Localhost/CN=local.example.com'
@philfreo
philfreo / keybase.md
Created May 21, 2015 18:18
keybase.md

Keybase proof

I hereby claim:

  • I am philfreo on github.
  • I am philfreo (https://keybase.io/philfreo) on keybase.
  • I have a public key whose fingerprint is 1F81 B578 6E87 8A29 B28B 4578 2DCA C2F7 8DAA 538B

To claim this, I am signing this object:

@philfreo
philfreo / body-drag-listener.js
Last active August 17, 2016 18:29
Keep track of when a file is currently dragged over a web page
// Keep track of when a file is dragged onto the page.
// Adding a 'filedragging' class to <body> when one is.
(function() {
// Since dragenter & dragleave get fired for children elements, need some workaround
// to tell when file is started & stopped being dragged onto page.
// Ideas extracted from https://github.com/bensmithett/dragster
var klass = 'filedragging',
first = false,
second = false;
$(document).on({
@philfreo
philfreo / localstorage_safari_private_shim.js
Last active November 20, 2019 22:49
Don't let localStorage/sessionStorage setItem throw errors in Safari Private Browsing Mode
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem
// to avoid the entire page breaking, without having to do a check at each usage of Storage.
if (typeof localStorage === 'object') {
try {
localStorage.setItem('localStorage', 1);
localStorage.removeItem('localStorage');
} catch (e) {
Storage.prototype._setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function() {};
@philfreo
philfreo / gist:fc068094f6e26d6995e2
Last active December 10, 2015 18:34
Backbone.js patch to prevent duplicate POSTs
// Queue of Backbone.Model save()s so that we don't issue multiple POSTs while waiting for
// the first one to come back. The first save() will always POST and the second will always PUT now.
// https://github.com/documentcloud/backbone/issues/345
// http://stackoverflow.com/a/6122530/137067
// https://gist.github.com/1037984
Backbone.Model.prototype._save = Backbone.Model.prototype.save;
Backbone.Model.prototype.save = function(attrs, options) {
// Queue up consecutive requests if the model is new and the initial
// POST request hasn't finished yet (xhr.readyState === 4 if the
// "request finished and response is ready").
@philfreo
philfreo / _README.md
Last active February 3, 2022 20:46
How to do conditional statements in Close.io template tags
@philfreo
philfreo / gist:cbab6aad493a6a3c21e8
Last active August 29, 2015 14:08
SMTP & IMAP details for popular email services

IMAP

Gmail/Google Apps:

Host: imap.gmail.com
Port: 993
Username: youremail@gmail.com or youremail@yourdomain.com (Google Apps)
Password: Your email password
SSL: Yes