Skip to content

Instantly share code, notes, and snippets.

philipstanislaus

View GitHub Profile
@philipstanislaus
philipstanislaus / sane-caching.nginx.conf
Last active Jul 6, 2020
Sample Nginx config with sane caching settings for modern web development
View sane-caching.nginx.conf
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@philipstanislaus
philipstanislaus / gist:c7de1f43b52531001412
Created Feb 26, 2016
JavaScript: Save a blob to disc
View gist:c7de1f43b52531001412
var saveBlob = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (blob, fileName) {
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
@philipstanislaus
philipstanislaus / includeJQuery.js
Created Jan 29, 2016
Include jQuery in any page from console
View includeJQuery.js
var jq = document.createElement('script');
jq.src = "http://code.jquery.com/jquery-2.2.0.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
You can’t perform that action at this time.