Skip to content

Instantly share code, notes, and snippets.

'use strict';
//Global service for global variables
angular.module('mean.system').factory('Global', [
function() {
var _this = this;
_this._data = {
user: window.user,
authenticated: !! window.user,
isAdmin: !!window.user && (_.indexOf(window.user.roles, 'admin') !== -1)
@whisher
whisher / gist:11321581
Created April 26, 2014 14:29
header.html mark-up
<div class="container" data-ng-controller="HeaderController">
<div class="navbar-header">
<button type="button" data-toggle="collapse" data-target="#navbar-collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span><span class="icon-bar"></span>
<span class="icon-bar"> </span></button>
<a href="/" class="navbar-brand" mean-token="'site-title'">LaLista</a>
</div>
<div id="navbar-collapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
development.js e test.js
module.exports = {
ports: 8443
// ....
};
prodution.js
angular.module('mean.system')
.factory('Menus', ['$http','$q', function($http,$q) {
return {
get : function(name,defaultMenu){
var deferred = $q.defer();
$http.get('/admin/menu/'+name, {
params: {
defaultMenu: defaultMenu
}
})
.controller('ArticleCreateCtrl', ['$scope', '$state', '$filter', 'Articles', function ($scope, $state, $filter, Articles) {
$scope.article = {};
$scope.save = function(){
$scope.article.categories = $filter('strcstoarray')($scope.article.categories);
Articles.store($scope.article).then(
function(data) {
$scope.article = data;
return $state.transitionTo('articles');
},
function(err) {
grunt
Running "clean:0" (clean) task
Running "jshint:all" (jshint) task
>> 43 files lint free.
Running "csslint:src" (csslint) task
>> 2 files lint free.
Running "concurrent:tasks" (concurrent) task
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "@WebProfilerBundle/Resources/config/routing/wdt.xml
" from "/home/whisher/public_html/myproject/app/config/routing.yml"
. Make sure the "WebProfilerBundle" bundle is correctly registered and load
ed in the application kernel class.
npm install grunt-contrib-copy --save-dev
```javascript
lib: 'public/system/lib',
copy: {
bootstrapFonts: {
cwd: '<%= lib %>/bootstrap/fonts/',
src: '*',
dest: 'public/build/fonts',
expand: true
FROM
// Request body parsing middleware should be above methodOverride
app.use(expressValidator());
app.use(bodyParser());
app.use(methodOverride());
TO
// Request body parsing middleware should be above methodOverride
app.use(expressValidator());
app.use(busboy());
"use strict";if(function(){function baseIndexOf(array,value,fromIndex){for(var index=(fromIndex||0)-1,length=array?array.length:0;++index<length;)if(array[index]===value)return index;return-1}function cacheIndexOf(cache,value){var type=typeof value;if(cache=cache.cache,"boolean"==type||null==value)return cache[value]?0:-1;"number"!=type&&"string"!=type&&(type="object");var key="number"==type?value:keyPrefix+value;return cache=(cache=cache[type])&&cache[key],"object"==type?cache&&baseIndexOf(cache,value)>-1?0:-1:cache?0:-1}function cachePush(value){var cache=this.cache,type=typeof value;if("boolean"==type||null==value)cache[value]=!0;else{"number"!=type&&"string"!=type&&(type="object");var key="number"==type?value:keyPrefix+value,typeCache=cache[type]||(cache[type]={});"object"==type?(typeCache[key]||(typeCache[key]=[])).push(value):typeCache[key]=!0}}function charAtCallback(value){return value.charCodeAt(0)}function compareAscending(a,b){for(var ac=a.criteria,bc=b.criteria,index=-1,length=ac.length;++index<le