Skip to content

Instantly share code, notes, and snippets.

View hcabnettek's full-sized avatar
🏠
Working from home

ck hcabnettek

🏠
Working from home
View GitHub Profile
@hcabnettek
hcabnettek / config.rb
Last active December 20, 2015 01:29
Would like 'node-compass' to compile .scss files when changes to them are made. Per the docs, I would expect 'styles.css' to be output to the --stylesheets folder. Thanks fora ny help.
http_path = "/public"
css_dir = "stylesheets"
sass_dir = "stylesheets"
iages_dir = "img"
@hcabnettek
hcabnettek / app.js
Created June 14, 2013 08:46
how can I unit test Service2 which depends on Service1? I keep getting a Service1Provider not found error.
!function(ng){
'use strict';
var module = ng.module('foo.services', []);
(function($ng, $module) {
function Service($q) {
return {
bar: function(a,b,c){
!function(ng){
'use strict';
var module = ng.module('app.controllers', []);
(function($ng, $module) {
function Controller($scope, requestContext) {
$scope.setWindowTitle = function (title) {
$scope.windowTitle = title;
};
@hcabnettek
hcabnettek / controller.specs.js
Created March 22, 2013 15:59
How do I get a reference to the angularjs controller defined with the 'controller' function? The test fails saying 'TestCtrl' is not a function. I have tried both with and without the quotes. $controller doc says it takes a constructor function or a string as an argument. Can anyone help?
describe('controller tests', function () {
var m, c;
beforeEach(function () {
m = angular.module('foo', []);
c = m.controller('TestCtrl', ['$scope', function ($scope) {
$scope.data = { foo: 'bar' };
$scope.changeFoo = function () {
$scope.data.foo = 'baz';
};
@hcabnettek
hcabnettek / gist:5218745
Created March 22, 2013 03:31
My jasmine test wont run. It's crashing when calling 'inject'. Where is this function defined? I verified Angularjs is loaded but there doesn't seem to be an inject method there. Any help? @kettebach
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller("FooCtrl", {$scope: scope});
}));
angular.module('SweetMvcApp.services', [])
.factory('tokenService', function ($http, $q) {
function getToken() {
$http.defaults.useXDomain = true;
delete $http.defaults.headers.common['X-Requested-With'];
var deferred = $q.defer(),
ajxArgs = {
@hcabnettek
hcabnettek / foo.js
Created November 4, 2012 18:45
Angular directive
angular.module('foo.directive', [])
.directive('restaurant', function(){
return {
restrict: 'E',
template: '<li>Hello World</li>'
}
});
angular.module('foo', ['foo.directive']);