Skip to content

Instantly share code, notes, and snippets.

@jhines2k7
jhines2k7 / waypoints-sticky-headers-package-json.json
Created July 23, 2015 21:55
package.json file for Waypoints with sticky headers
{
"name": "waypoints-elements-different-heights",
"version": "0.1.0",
"description": "Simple demonstration of using Waypoints to adjust to sticky elements with different heights",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
@jhines2k7
jhines2k7 / gulp-livereload-package.json
Last active September 3, 2015 15:19
Gulp livereload package.json file
{
"name": "gulp-watch-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@jhines2k7
jhines2k7 / modified-waypoint-sticky-headers.html
Created July 24, 2015 13:09
Modified Waypoint sticky headers
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Waypoints Elements Different Heights</title>
<style>
html, body {
height: 100%;
margin: 0;
@jhines2k7
jhines2k7 / gruntfile-for-html2js-task.js
Last active August 29, 2015 14:25
Gruntfile for html2js task
/**
* Created by jhines on 7/24/2015.
*/
module.exports = function(grunt) {
grunt.initConfig({
html2js: {
options: {
base: '',
module: 'sandbox.templates',
singleModule: true,
@jhines2k7
jhines2k7 / package.json-file-for-html2js.json
Last active August 29, 2015 14:25
Package.json for grunt html2js and karma
{
"name": "angular-directive-test-sandbox",
"version": "0.1.0",
"description": "Simple application to experiment with unit testing directives in angularjs",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@jhines2k7
jhines2k7 / service-describe-block-mock-dependencies.js
Created July 26, 2015 11:41
A Jasmine describe block that demonstrates injecting mock dependencies into a unit test for a service
describe('SimpleService', function(){
var mockWindow, mockModalSvc, sampleSvcObj;
beforeEach(function(){
module(function($provide){
$provide.service('$window', function(){
this.alert= jasmine.createSpy('alert');
});
$provide.service('modalSvc', function(){
this.showModalDialog = jasmine.createSpy('showModalDialog');
});
@jhines2k7
jhines2k7 / intellij-node-gitignore-file
Created July 26, 2015 11:52
Git ignore file for Intellij projects that use node.js
# Created by https://www.gitignore.io
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
@jhines2k7
jhines2k7 / mock-services-with-promises.js
Last active August 29, 2015 14:25
A snippet that demonstrates how to mock services in unit tests that use promises
// simple factory
angular.module('moduleUsingPromise', [])
.factory('dataSvc', function(dataSourceSvc, $q) {
function getData() {
var deferred = $q.defer();
dataSourceSvc.getAllItems().then(function(data) {
deferred.resolve(data);
}, function(error) {
deferred.reject(error);
@jhines2k7
jhines2k7 / unit-test-controller-return-promise.js
Last active August 29, 2015 14:26
AngularJS unit test of a controller that uses a service that returns a promise
/**
* Created by jhines on 7/28/2015.
*/
describe('NavbarController search by three digit tail number', function(){
'use strict';
var scope, navbarController, $window, httpBackend, ronTableService, deferred;
beforeEach(function(){
module('mxnet.navbar', 'mxNetApp', 'mxnet.lineplanning');
@jhines2k7
jhines2k7 / restangular-query-for-one-tail.js
Created July 29, 2015 20:16
Restangular query for one tail
return Restangular.all('retrieveRonTails').post({
filters: {
tails: [1234]
}
},{},{})