Skip to content

Instantly share code, notes, and snippets.

@jjgrainger
jjgrainger / keybase.md
Created December 2, 2017 15:52
Keybase proof

Keybase proof

I hereby claim:

  • I am jjgrainger on github.
  • I am jjgrainger (https://keybase.io/jjgrainger) on keybase.
  • I have a public key ASC9scILu4ztrzC5CGV9pQe3kOVsxzs6eDqJgDsg9kccuQo

To claim this, I am signing this object:

@jjgrainger
jjgrainger / kittens.coffee
Last active November 3, 2016 20:37
Hubot deliver gifs of kittens
# Description:
# Feeling down? Boost your mood with some Kitten Therapy!
#
# Dependencies:
# None
#
# Configuration:
# GIPHY_API_KEY - Your Giphy API key
#
# Commands:
@jjgrainger
jjgrainger / Vector.js
Last active July 29, 2024 11:18
A simple Vector class in javascript
var Vector = function(x, y) {
this.x = x || 0;
this.y = y || 0;
};
// return the angle of the vector in radians
Vector.prototype.getDirection = function() {
return Math.atan2(this.y, this.x);
};
@jjgrainger
jjgrainger / bark.coffee
Last active April 22, 2016 12:29
Hubot bark script
# all scripts are modules, a function which accepts the robot
module.exports = (robot) ->
# an array of random barks that bowie can make
barks = [
'bark!',
'wooof!',
'grrrrroowwwll',
'meow?'
]
@jjgrainger
jjgrainger / .htaccess
Created January 9, 2015 12:07
.htaccess load production uploads at localhost in WP
# Attempt to load files from production if they're not in our local version
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://domain.com/wp-content/uploads/$1
</IfModule>
@jjgrainger
jjgrainger / array_insert.php
Last active December 3, 2017 10:25
Add an element to an array at a specific position
<?php
/*
Array insert
@array the array to add an element to
@element the element to add to the array
@position the position in the array to add the element
*/