Skip to content

Instantly share code, notes, and snippets.

View tinyfly's full-sized avatar

Jeff Adams tinyfly

View GitHub Profile
@tinyfly
tinyfly / TextInput.vue
Created February 14, 2020 00:59
In VueJS, use a computed property setter as an easy way to pass down v-model within your component without using watchers.
<template>
<div class="form-group">
<label :for="uid"><slot></slot></label>
<input :id="uid" type="text" v-model="innerValue">
</div>
</template>
<script>
/**
* Custom text input component
@tinyfly
tinyfly / boot-intercom-respond.js
Last active March 31, 2021 19:10
Start up the Intercom Respond widget being sure to clear previous user's conversations.
/**
* Boots up Intercom (intercom.io). This should be run on page load
* @param {String} APP_ID - Your Intercom app id
* @param {Function} moment - moment.js
* @param {Object} [user] - information about the logged in user
*/
startupIntercom(APP_ID, moment, user) {
// basic settings for all users
const intercomSettings = {

Fluid Grid Using Text-align: Justify

A new technique for responsive grids I've been working on which uses inline-block and text-align: justify.

Take a look at this article for an explanation of the fundamentals of the technique:

http://www.barrelny.com/blog/text-align-justify-and-rwd/

Essentially, margins are calculated by the browser and never specified in the CSS. This saves a lot of tedious work! Also by not having to use floats, clearfixes, or nth-child, we avoid many common problems associated with more traditional methods.

@tinyfly
tinyfly / tinyfly.elapsedTime.js
Created June 30, 2011 20:00
Calculate the elapsed time between two dates
//create 1 global variable for namespacing purposes.
if (typeof tinyfly === 'undefined') {
tinyfly = {};
}
/* Handles calculating elapsed time between two dates */
tinyfly.elapsedTime = (function() {
var times = {},
timeStart, timeEnd;
@tinyfly
tinyfly / tinyfly.loading.js
Created June 16, 2011 21:42
Add and remove loading animation to ajax calls (jQuery)
// This code depends on jQuery
//create 1 global variable for namespacing purposes.
if (typeof tinyfly === 'undefined') {
tinyfly = {};
}
/* Handles adding and removing loading animations for ajax calls */
tinyfly.loading = (function($) {
var defaults = {},
@tinyfly
tinyfly / is_array.js
Created July 10, 2010 04:46
Array Detection
/*
Since using the typeof operator to test an array returns 'object'
we need another way to test it.
( via http://jqfundamentals.com/book/book.html#N20659 )
*/
var is_array = function (my_array) {
if (Object.prototype.toString.call(my_array) === '[object Array]') {
return true;
}
return false;