Skip to content

Instantly share code, notes, and snippets.

View tjFogarty's full-sized avatar
🇮🇪

T.J. Fogarty tjFogarty

🇮🇪
View GitHub Profile
// given a date range
// and some unavailable dates
// construct multiple allocations to fit around them
// e.g., 21st - 28th with 23rd & 24th unavailable
// gives us 2 allocations: 21st - 22nd and 25th - 28th
import moment from 'moment';
function getDatesInRange(startDate, endDate) {
const dates = [];
<script>
import { onMount } from 'svelte'
import { records, record } from './stores'
import * as api from './api'
export let currentRecord
export let hasBeenClicked = false
record.subscribe(value => {
currentRecord = value

Keybase proof

I hereby claim:

  • I am tjFogarty on github.
  • I am fogarty (https://keybase.io/fogarty) on keybase.
  • I have a public key whose fingerprint is 3061 7481 280C 07B5 4542 02E2 AB51 0170 42A9 956C

To claim this, I am signing this object:

@tjFogarty
tjFogarty / SassMeister-input-HTML.html
Created February 25, 2016 16:18
Generated by SassMeister.com.
<h1>This should be a responsive heading title right here</h1>
@tjFogarty
tjFogarty / test-wp-search-form.js
Created August 11, 2015 15:13
Testing WordPress Search Form with CasperJS
/*global casper*/
'use strict';
var config = require('../config'),
page = 'http://' + config.local_url + '/',
formData = {
's': 'suppliers' // search term
};
@tjFogarty
tjFogarty / wiredep.js
Created August 8, 2015 10:52
Gulp + Wiredep + Timber + Twig
var gulp = require('gulp');
var config = require('../config');
var wiredep = require('wiredep').stream;
gulp.task('wiredep', function () {
gulp.src(config.wiredep_file)
.pipe(wiredep({
directory: 'assets/lib',
ignorePath: '..',
fileTypes: {
@tjFogarty
tjFogarty / base.twig
Last active August 29, 2015 14:26
Example base.twig for use with Timber plugin for WordPress
<!doctype html>
<html class="no-js" {{site.language_attributes}}>
<head>
<meta charset="{{site.charset}}">
<title>
{% if wp_title %}
{{ wp_title }} - {{ site.name }}
{% else %}
{{ site.name }}
@tjFogarty
tjFogarty / utils.js
Created July 26, 2015 20:00
Little utility object
/**
* Utilities
* see http://youmightnotneedjquery.com/
* @type {Object}
*/
var U = {
/**
* Call a function when DOM is ready
* @param {Function} fn Function to call when DOM is ready
*/
@tjFogarty
tjFogarty / overview.php
Created April 16, 2015 08:14
WordPress + Timber example
<?php
/**
* Template Name: Overview
*/
if (!class_exists('Timber')){
echo 'Timber not activated. Make sure you activate the plugin in <a href="/wp-admin/plugins.php#timber">/wp-admin/plugins.php</a>';
return;
}
@tjFogarty
tjFogarty / alert.css
Created April 8, 2015 15:03
EE Site info
.c-alert {
position: fixed;
background: #333;
background: rgba(51, 51, 51, 0.7);
bottom: 30px;
color: #fff;
text-align: center;
padding: 15px;
border-radius: 4px;
width: 300px;