Skip to content

Instantly share code, notes, and snippets.

View tbrd's full-sized avatar

Thomas Hamshere-Clarke tbrd

View GitHub Profile
@tbrd
tbrd / index.html
Created February 12, 2014 12:12
Adding a search form to a new Flight application
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>example</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/css/main.css">
</head>
@tbrd
tbrd / search-form.spec.js
Last active August 29, 2015 13:56
jasmine-flight test to check handling of a search form
'use strict';
describeComponent('component/search-form', function () {
// Initialize the component and attach it to the DOM
beforeEach(function () {
var fixture = '<form><input class="js-keywords" type="text" value="teststring"/></form>'
setupComponent(fixture);
});
@tbrd
tbrd / search-form.js
Last active August 29, 2015 13:56
A search form component for Flight
define(function (require) {
'use strict';
/**
* Module dependencies
*/
var defineComponent = require('flight/lib/component');
@tbrd
tbrd / default.js
Created February 12, 2014 13:45
Including the search form component in the default page
define(function (require) {
'use strict';
/**
* Module dependencies
*/
var searchForm = require('component/search-form');
@tbrd
tbrd / keyword-processor.spec.js
Last active August 29, 2015 13:56
Tests for keyword string processor
'use strict';
describeComponent('component/keyword-processor', function () {
// Initialize the component and attach it to the DOM
beforeEach(function () {
setupComponent();
});
it('should be defined', function () {
@tbrd
tbrd / keyword-processor.js
Last active August 29, 2015 13:56
Keyword string processor
define(function (require) {
'use strict';
/**
* Module dependencies
*/
var defineComponent = require('flight/lib/component');
@tbrd
tbrd / default.js
Created February 22, 2014 10:52
Default page with searchForm and keywordProcessor
define(function (require) {
'use strict';
/**
* Module dependencies
*/
var searchForm = require('component/search-form');
var keywordProcessor = require('component/keyword-processor');
@tbrd
tbrd / hashtags.json
Last active August 29, 2015 13:56
Hashtag data
{
"hashtags" : [
{
"text" : "trocadero",
"frequency" : 24
},
{
"text" : "beer"
"frequency" : 18
},
@tbrd
tbrd / hashtags.mustache
Created March 2, 2014 16:28
Hashtags template
<table class="js-hashtags">
<thead>
<tr>
<th>Hashtag</th>
<th>Frequency</th>
</tr>
</thead>
<tbody>
{{#hashtags}}
<tr>
@tbrd
tbrd / hashtags.spec.js
Last active August 29, 2015 13:56
Hashtags component spec
'use strict';
describeComponent('component/hashtags', function () {
// Initialize the component and attach it to the DOM
beforeEach(function () {
setupComponent();
});
it('should be defined', function () {