I'd love some feedback on a project folder structure I've been considering/trying out. I just don't know why people aren't doing this already and I think I may just be missing something. Is there a problem with the different.md
that I'm just missing. Leave comments below. Thanks for the feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"people": { | |
"Joe": { | |
"birthday": "October 18th, 1988", | |
"favoriteIceCream": "Mint Chocolate Chip" | |
}, | |
"Mary": { | |
"birthday": "December 23rd, 1986", | |
"favoriteIceCream": "Vanilla" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stateProvider. | |
state('main', { | |
abstract: true, | |
url: '/', | |
templateUrl: '/main/index.html', | |
controller: 'SuperCtrl', | |
resolve: { | |
isAuthenticated: function($q, $http) { | |
var deferred = $q.defer(); | |
$http.get('/api/v1/auth/isAuthenticated').then(function(response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('bs.common.models').factory('AuthInterceptor', function ($rootScope, $q, $window) { | |
return { | |
request: function (config) { | |
config.headers = config.headers || {}; | |
var token = $window.localStorage.getItem('user-token'); | |
if (token) { | |
config.headers.Authorization = 'Bearer ' + token; | |
} | |
return config; | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just paste this into the console on http://www.jshint.com/docs/options/ | |
(function() { | |
var i, row, link, span, extraCol, checkbox, value; | |
var rows = document.querySelectorAll('table.options tr'); | |
var links = document.querySelectorAll('table.options a'); | |
// add checkboxes | |
for (var i = 0; i < rows.length; i++) { | |
row = rows[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste this into the console on http://conf.utahjs.com/vote | |
(function() { | |
var tableBody = $('tbody'); | |
$('.score').map(function(index, score) { | |
return { | |
el: $(score).parents('tr'), | |
score: ~~score.innerText | |
}; | |
}).sort(function(a, b) { | |
return a.score < b.score ? 1 : a.score > b.score ? -1 : 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onerror = function (errorMsg, url, lineNumber, columnNumber, errorObject) { | |
if (/<omitted>/.test(errorMsg)) { | |
console.error('Error: ' + errorObject ? errorObject.message : errorMsg); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app').directive('kcdBase64', function () { | |
'use strict'; | |
return { | |
restrict: 'A', | |
template: [ | |
'<span class="button file-upload-button">', | |
'<span>Select Image</span>', | |
'<input type="file" class="input-file" accept="image/*">', | |
'</span>' | |
].join(''), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How bad is this? Do you see any problems with doing this? | |
var scopePrototype = Object.getPrototypeOf($rootScope); | |
var oldNew = scopePrototype.$new; | |
// hijack the prototype's $new | |
scopePrototype.$new = function $new() { | |
var scope = oldNew.apply(this, arguments); | |
addFunctionality(scope); | |
return scope; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var url = require('url'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var base = path.join(process.cwd(), process.argv[2] || ''); | |
var port = process.argv[3] || 8888; | |
var extensionRegex = /\.([0-9a-z]+)(?:[\?#]|$)/i; | |
var contentTypeMap = { | |
html: 'text/html', |