Instantly share code, notes, and snippets.

Shane Grey shanemgrey

View GitHub Profile
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View autoFocus.directive.js
* app.autoFocus Module
* Simple directive to focus the element whem DOM ready
'use strict';
.module('app.autoFocus', [])
.directive('autoFocus', function($timeout) {
View ngSearchBox.html
<!-- Full width search box with icons and actions associated to List and Grid Views -->
<!-- Requires Angular (1.3 used here), Bootstrap (3), and Font Awesome -->
<div class="row">
<div class="input-group m-b">
<span class="input-group-addon"><i class="fa fa-search"> </i></span>
<!-- auto-focus is a directive also found as a gist here. It sets the focus to an element on load. -->
<input class="form-control" auto-focus ng-init="$scope.searchQuery = $stateParams.query" type="text" minlength="3" maxlength="100" ng-model="searchQuery" placeholder="Search...">
<!-- List and Grid view buttons. Other elements watch listView and change as it does. -->
<!-- If using more than two states, this will need to be reworked. But it's easier as a boolean -->
<div class="input-group-addon">