Skip to content

Instantly share code, notes, and snippets.

Avatar
🇮🇪

T.J. Fogarty tjFogarty

🇮🇪
View GitHub Profile
View skip-unavailable-dates.js
// 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 = [];
View Upvotes.svelte
<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
View keybase.md

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 Feb 25, 2016
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<h1>This should be a responsive heading title right here</h1>
@tjFogarty
tjFogarty / test-wp-search-form.js
Created Aug 11, 2015
Testing WordPress Search Form with CasperJS
View test-wp-search-form.js
/*global casper*/
'use strict';
var config = require('../config'),
page = 'http://' + config.local_url + '/',
formData = {
's': 'suppliers' // search term
};
@tjFogarty
tjFogarty / wiredep.js
Created Aug 8, 2015
Gulp + Wiredep + Timber + Twig
View wiredep.js
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 Aug 29, 2015
Example base.twig for use with Timber plugin for WordPress
View base.twig
<!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 Jul 26, 2015
Little utility object
View utils.js
/**
* 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 Apr 16, 2015
WordPress + Timber example
View overview.php
<?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;
}
View alert.css
.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;
You can’t perform that action at this time.