Skip to content

Instantly share code, notes, and snippets.

View Sitebase's full-sized avatar
🤘

Wim Mostmans Sitebase

🤘
View GitHub Profile
@Sitebase
Sitebase / pre-commit
Created June 21, 2013 08:58
Pre-commit hook for Git to take a webcam shot every time you commit something.
HOOKSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TIMESTAMP=$(date +"%Y%m%d%H%M")
COMMITID=$(git rev-parse HEAD)
PROJECT=$($test | awk -F/ '{print $(NF-1)}') # this doesn't work yet
imagesnap -q -w 1 ~/.gitshots/$TIMESTAMP-$COMMITID.jpg
@Sitebase
Sitebase / commit_files.sh
Created June 22, 2013 11:30
Bash function to get list of files that will be committed. Very handy when writing Git hooks.
# Function to get a list of files that will be committed by extension
# you can for example do "$(commit_files js css)" to get a list of js and css files that wil lbe commited
function commit_files() {
if [ $# -eq 0 ] ; then
echo $(git diff-index --name-only --diff-filter=ACM --cached HEAD --)
exit 0
fi
extensions=''
@Sitebase
Sitebase / helper.js
Created June 25, 2013 08:18
Check if page is running in a Facebook frame
function NotInFacebookFrame(){
return top === self;
}
@Sitebase
Sitebase / gist:6060856
Created July 23, 2013 08:40
Protect window.console method calls, e.g. console is not defined on IE unless dev tools are open, and IE doesn't define console.debug
(function() {
if (!window.console) {
window.console = {};
}
// union of Chrome, FF, IE, and Safari console methods
var m = [
"log", "info", "warn", "error", "debug", "trace", "dir", "group",
"groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd",
"dirxml", "assert", "count", "markTimeline", "timeStamp", "clear"
];
@Sitebase
Sitebase / index.html
Created August 7, 2013 14:45
For the people that will miss the blink element in the new FireFox. https://www.mozilla.org/en-US/firefox/23.0/releasenotes/
<blinky>Look, it blinks!</blinky>
@Sitebase
Sitebase / form.html
Last active December 21, 2015 19:29
BuboBox remote form test
<label for="name">Name</label>
<input type="text" name="name" id="name" value="" />
<label for="email">Email</label>
<input type="email" name="email" id="email" value="" data-validation-rule="valid_email" />
@Sitebase
Sitebase / gist:8239841
Last active January 2, 2016 02:49
Overlay example
<img id="image" src="{{ image }}" />
<img src="//bubobox.static.s3.amazonaws.com/overlay_templates/paperhole.png" />
@Sitebase
Sitebase / index.html
Created January 6, 2014 11:22
Challenge demo examples
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Video challenge</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,600,700,800,300' rel='stylesheet' type='text/css'>
<style>
<script>
// Send cookie data to hacker
alert('Thanks for your cookies:' + document.cookie);
</script>
include foo