Skip to content

Instantly share code, notes, and snippets.

View app.js
var connect = require('connect')
var csp = require('helmet-csp')
var app = connect()
app.use(csp({
directives: {
mediaSrc: ['media.example.com']
}
}))
@EvanHahn
EvanHahn / apm_remove_versions.rb
Created Jan 8, 2015
A Ruby script to remove versions from the output of `apm list --installed --bare`.
View apm_remove_versions.rb
#!/usr/bin/env ruby
IO.foreach(ARGV.first) do |line|
puts line.split('@').first
end
# Licensed under the Unlicense. <http://unlicense.org/>
View gist:99edd459a4f08bb6fd6c
var express = require('express');
var path = require('path');
var HEADER_VALUE = "default-src 'self';";
var HEADERS = [
'Content-Security-Policy',
'X-Content-Security-Policy',
'X-Webkit-CSP'
];
View keybase.md

Keybase proof

I hereby claim:

  • I am EvanHahn on github.
  • I am evanhahn (https://keybase.io/evanhahn) on keybase.
  • I have a public key whose fingerprint is C3AB 6FA7 DC98 0294 2D89 C540 4329 0CC8 681B 62EB

To claim this, I am signing this object:

@EvanHahn
EvanHahn / gist:38f08f40a23e0cb9f4b0
Created Sep 5, 2014
Disabling some headers set by Express's static middleware.
View gist:38f08f40a23e0cb9f4b0
var express = require("express");
var onHeaders = require("on-headers");
var path = require("path");
var app = express();
// ...
app.use(function(req, res, next) {
onHeaders(res, function() {
@EvanHahn
EvanHahn / brochure.css
Created Jul 21, 2014
showing the difference in the brochure for website issue #18230
View brochure.css
@charset "UTF-8";
/* ======================================================
v 0.1.0
Versioned according to http://semver.org/spec/v2.0.0.html
Primary Maintainer: @albert
Contributors:
====================================================== */
@EvanHahn
EvanHahn / .gitignore
Last active Aug 29, 2015
Working on Helmet issue #57.
View .gitignore
.DS_Store
*.swp
node_modules
*.log
@EvanHahn
EvanHahn / app.js
Created Jun 24, 2014
Dealing with Helmet issue #55.
View app.js
var path = require("path");
var connect = require("connect");
var favicon = require("serve-favicon");
var helmet = require("helmet");
var app = connect();
app.use(helmet.defaults());
var faviconPath = path.resolve(__dirname, "favicon.ico");
View gist:51b35166bfe77694d317
var iframesLoaded = 0;
$("form").each(function() {
var $form = $(this);
var $iframe = $("<iframe name='temporary-iframe'></iframe>");
var oldTarget = $form.prop("target");
$form.prop("target", "temporary-iframe");
@EvanHahn
EvanHahn / 158.bf
Created Apr 15, 2014
Daily programmer #158, in Brainfuck
View 158.bf
first digit
,------------------------------------------------
[>++++++++++<-]
second digit
,------------------------------------------------
>>
third digit
,------------------------------------------------
You can’t perform that action at this time.