Skip to content

Instantly share code, notes, and snippets.

View JordanForeman's full-sized avatar
👨‍💻

Jordan Foreman JordanForeman

👨‍💻
View GitHub Profile
@JordanForeman
JordanForeman / CLAUDE.md
Created April 22, 2025 15:27
Base Claude Prompts
me: name: Jordan Foreman - You are an expert software engineer with a diverse skillset - You are highly motivated to write code that is readable and maintainable by humans - You are passionate about ensuring that your code is well tested, preferring test-driven development when able
/**
* Measures a canvas and splits lines of text so that they fit within the width thereof.
* Requires some text styling to be applied to the canvasContext already, and will not function as expected if that is changed between calculation and drawing of returned lines
*
* @param canvas - <canvas>
* @param text - String the text to measure and break up
* @param padding - the horizontal padding to take into account (assumes left/right padding are equivalent)
*
* @returns [Array] - an array containing lines of text that, when rendered on the canvas will not exceed the canvas' width
*/
@JordanForeman
JordanForeman / hm-api.php
Created December 29, 2015 22:29
Extending WP API - Code Sample 3
namespace HM\REST_API;
class REST_API {
public function __construct() {
add_action('rest_api_init', array($this, 'register_routes'));
}
public function register_routes() {
@JordanForeman
JordanForeman / hm-api.php
Last active December 29, 2015 22:27
Extending WP API - Code Sample 2
namespace HM\REST_API;
class REST_API {
public function __construct() {
add_action('rest_api_init', array($this, 'register_routes'));
}
public function register_routes() {
$api_namespace = 'hm/v1';
@JordanForeman
JordanForeman / hm-api.php
Last active December 29, 2015 21:50
Extending WP API - Code Sample 1
namespace HM\REST_API;
class REST_API {
}
new REST_API();
@JordanForeman
JordanForeman / keybase.md
Created June 3, 2015 13:38
Keybase Verification

Keybase proof

I hereby claim:

  • I am jordanforeman on github.
  • I am jordanforeman (https://keybase.io/jordanforeman) on keybase.
  • I have a public key whose fingerprint is 1B74 016D 06FD 4CA1 82CD 70D4 851A 4889 2A34 D49C

To claim this, I am signing this object:

@JordanForeman
JordanForeman / EventDispatcher.js
Created March 25, 2015 16:20
Basic Custom Events
EventDispatcher = {
events: {},
on: function(event, callback) {
var handlers = this.events[event] || [];
handlers.push(callback);
this.events[event] = handlers;
},
@JordanForeman
JordanForeman / _queries.scss
Created March 25, 2015 16:17
Sass Media Queries for Progressive Enhancement
/* These numbers are all arbitrary; feel free to tweak them to your liking/needs */
$mobileBreakpoint: 360px;
$tableBreakpoint: 720px;
$desktopBreakpoint: 1080px;
@mixin breakpoint($bp) {
/* Use min-width for a progressive-enhancement approach */
@media screen and (min-width: $bp) { @content }
}
@JordanForeman
JordanForeman / JavaScript Breakpoint Responder
Created May 23, 2014 16:53
JavaScript Breakpoint Responder
// Responsive JavaScript Helpers
/* CONSTANTS HOLDER */
var ScaleDirection = {
SCALE_UP : "UP",
SCALE_DOWN : "DOWN"
};
/* RESPONDER CLASS */
@JordanForeman
JordanForeman / RGB.js
Last active August 29, 2015 13:56
A simple JavaScript RGB class
var RGB = function(r, g, b){
this.r = r;
this.g = g;
this.b = b;
};
RGB.prototype.toString = function(){