Skip to content

Instantly share code, notes, and snippets.

View geedew's full-sized avatar

Drew geedew

View GitHub Profile
@geedew
geedew / vagrant-scp
Last active July 22, 2017 15:16
Copying files to a Vagrant VM from host
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
SERVER=localhost
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} $FILE vagrant@$SERVER:$PATH
@geedew
geedew / remove-known-hosts.sh
Last active February 18, 2020 17:29
Quickly removing a ~/.ssh/known_hosts entry
# ssh-keygen -R hostname [-f known_hosts_file]
# ssh-keygen -r hostname [-f input_keyfile] [-g]
#e.g.
ssh-keygen -R 192.168.99.99
ssh-keygen -R mytestdomain.vagrant
@geedew
geedew / dw-js-frame-bust
Created February 20, 2014 15:47
David Walsh's Frame Busting
if (top.location != self.location) {
top.location = self.location.href;
}
@geedew
geedew / js-frame-bust
Created February 20, 2014 15:46
Javascript Frame Busting
if(top != self) {
top.onbeforeunload = function() {};
top.location.replace(self.location.href);
}
@geedew
geedew / whitelisted-x-frame-options
Created February 20, 2014 15:35
A whilte-listed Apache solution for X-Frame-Options SAMEORIGIN
<VirtualHost *:80>
# ...
<IfModule mod_headers.c>
# Allow some urls, block all others; whitelisting
<LocationMatch ^((?!(firstUrlAllowed|secondUrlAllowed)).)*$>
Header always append X-Frame-Options SAMEORIGIN # Block any site from applying an iframe.
</LocationMatch>
</IfModule>
</VirtualHost>
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@geedew
geedew / broken.js
Last active December 26, 2015 13:29
Test Code
;(function(win, undefined) {
var applicationName = "My Broken App";
libs = { one : 'jQuery', two : 'Underscore', three : 'Backbone' };
BioSync.Common.loadLibs = function( libraries ) {
"use strict";
var e = 0, r;
BioSync.Common.applicationName = applicationName;
@geedew
geedew / rAF.js
Created September 5, 2013 02:20 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<!-- Online here: http://ejohn.org/files/bugs/isObjectLiteral/ -->
<title>isObjectLiteral</title>
<style>
li { background: green; } li.FAIL { background: red; }
iframe { display: none; }
</style>