Skip to content

Instantly share code, notes, and snippets.

@joshfreemanIO
joshfreemanIO / konamicode.js
Created March 2, 2013 01:49
Plays the Metal Gear Solid "Alert" sound when the Konami Code is entered. Modify path to local instance of the sound file.
counter = 0;
window.onkeydown = function(e){konamicode(e.which)}
function konamicode(button)
{
var code = new Array(38,38,40,40,37,39,37,39,66,65);
if(code[counter] === button)
{
<?php
class gzipper
{
public function gzipFile($file,$destination_directory = '')
{
try
{
@joshfreemanIO
joshfreemanIO / pre-commit
Last active August 29, 2015 13:57
Pre-Commit Hook for Git
#!/usr/bin/ruby
# https://www.ruby-forum.com/topic/122170#544763
git_files = `git diff --cached --name-only`.lines.map(&:chomp)
offending_lines = {}
def File.binary? name
open name do |f|
(function($, undefined) {
$.widget("grok.savemenot", {
_create: function() {
this.inputs = this.element.find('input, textarea, select, button');
this.submit = $('[type="submit"]');
@joshfreemanIO
joshfreemanIO / index_generator.rb
Last active August 29, 2015 13:58
Jekyll Plugin to create indexes on any posts' front-matter
module Jekyll
###
# # Index Generator
#
# Jekyll Plugin to build indexes from Posts
#
# ## Installation and Configuration
#
# To use in a Jekyll application, copy this file into _plugins
@joshfreemanIO
joshfreemanIO / gitlog
Last active August 29, 2015 14:02
List the short hash and your message summary for the previous 12 hours
# Place this into your .bash_aliases and ensure you source the file
# To use, run `gitlog` to get the commits for the past 12 hours
# To get a different time range, run `gitlog 36` for the previous 36 hours
function gitlog() {
if [ -z "$1" ]
then
HOURS=12
else
HOURS=$1
@joshfreemanIO
joshfreemanIO / backup.sh
Created August 5, 2014 01:15
Backup all repositories
#!/bin/sh
# Backup of git directories
DIRECTORIES=(
"/Users/josh/EncFS-Decrypted/Finances"
);
DATE=`date -u`;
# For each directory in the directories array,

Date: [date]

Between Grok Interactive, LLC and [employee name].

Summary:

In short; neither of us will share any confidential information about each other, by any means, with anyone else.

What's confidential information?

@joshfreemanIO
joshfreemanIO / rot13.js
Last active August 29, 2015 14:06
ROT13 - Caeser's Cipher
function rot13(string) {
var set = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var translation = '';
var string_length = string.length;
var position;
for (var index = 0; index < string_length; index++) {
position = set.indexOf(string[index]);
if (position >= 0) {
@joshfreemanIO
joshfreemanIO / calculator.js
Last active August 29, 2015 14:13
Calculator demo
var buttons = document.getElementsByTagName('button');
var display = document.getElementById('display');
var currentValue = 0;
var operand = 0;
var operator = '=';
var previousClicked = '=';
var cleared = true;
/**
* Given a button value, preform the correct operation and update the display