Skip to content

Instantly share code, notes, and snippets.

Jonathan Abbett jabbett

Block or report user

Report or block jabbett

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jabbett
jabbett / _form.html.erb
Last active Feb 22, 2019
ActsAsTaggableOn with collection_check_boxes
View _form.html.erb
<%= form_for(@sundae) do |f| %>
<!--
collection_check_boxes requires 4 parameters, the last two are methods that access
the value and text from the collection, respectively. Hence the need for
SundaesHelper.valid_flavors!
-->
<%= f.collection_check_boxes(:flavor_list, valid_flavors, :first, :first) do |b| %>
<!-- FYI: I use Bootstrap 4, so I customized how the checkboxes would render -->
<div class="form-check">
<label class="form-check-label"><%= b.check_box class: 'form-check-input' %> <%= b.value %></label>
@jabbett
jabbett / ahoy_base.rb
Last active Apr 12, 2019
Setting up Ahoy models to use a separate datastore
View ahoy_base.rb
module Ahoy
class AhoyBase < ActiveRecord::Base
establish_connection DB_STATS
self.abstract_class = true
end
end
@jabbett
jabbett / bootstrap-4-popover.js
Created Nov 29, 2016
Managing popovers in Bootstrap 4
View bootstrap-4-popover.js
/*
** This gist shows how to implement Bootstrap 4 popovers that:
** a) disappear automatically when the user clicks outside the popover
** b) only appear one at a time
*/
// Hide other popover when new one appears
$('[data-original-title]').on('show.bs.popover', function () {
$('[data-original-title]').not(this).popover("hide");
});
@jabbett
jabbett / show.yml
Created Nov 23, 2016
Product tour definition for Abraham
View show.yml
intro:
steps:
1:
text: "Welcome to your dashboard! This is where we'll highlight key information to manage your day."
2:
title: "Events"
text: "If you're participating in any events today, we'll show that here."
attachTo:
element: ".dashboard-events"
placement: "right"
@jabbett
jabbett / actmd_js_excerise.md
Last active May 19, 2016
JavaScript exercise for ACT.md UI Engineer position
View actmd_js_excerise.md

JavaScript exercise for ACT.md UI Engineer position

Your task is to implement a view that is able to display a list of video titles using a paginated search API; in this case, Google's YouTube API.

You may use any JavaScript framework you like. At ACT.md we use Backbone and Marionette, but choose Angular, Ember, etc., if that's more comfortable.

There are also many ways to approach the UX of this problem -- you can pick your favorite. For example:

@jabbett
jabbett / instiki.css
Last active Aug 29, 2015
Jabbett's Responsive Instiki Stylesheet
View instiki.css
/*
** Jabbett's Responsive Instiki Stylesheet
** Make Instiki feel like a modern web application (almost).
** Replace public/stylesheets/instiki.css with this file.
*/
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
/* http://meyerweb.com/eric/tools/css/reset/
v2.0b1 | 201101
@jabbett
jabbett / backbone_pushstate_router.js
Last active Dec 15, 2015 — forked from tbranyen/backbone_pushstate_router.js
Updated protocol check to respect javascript: pseudo-protocol and hash links (#foo) Updated to support IE
View backbone_pushstate_router.js
// Use absolute URLs to navigate to anything not in your Router.
// Note: this version works with IE. Backbone.history.navigate will automatically route the IE user to the appropriate hash URL
// Use delegation to avoid initial DOM selection and allow all matching elements to bubble
$(document).delegate("a", "click", function(evt) {
// Get the anchor href and protcol
var href = $(this).attr("href");
var protocol = this.protocol + "//";
// Ensure the protocol is not part of URL, meaning its relative.
You can’t perform that action at this time.