Skip to content

Instantly share code, notes, and snippets.

View liorkesos's full-sized avatar
😎
chillin

Lior Kesos liorkesos

😎
chillin
View GitHub Profile
@liorkesos
liorkesos / Overview
Last active May 23, 2016 09:21
Up the MEAN stack - Package flow...
In MEAN data is collected and communicated in the package and it goes through the different layers of angular, express and mongo.
The data "moves" "up the stack" from the angular view to the controller and then the service and from then to an express route a controller and model schema which is used to save the object in the db.
We'll use the create.html from the articles core package to demonstrate this.
@liorkesos
liorkesos / config structure
Last active August 29, 2015 14:02
mean.io configuration server/config/env
config
├── assets.json
├── config.js
├── env
│   ├── all.js
│   ├── development.js
│   ├── production.js
│   └── test.js
├── express.js
├── passport.js
@liorkesos
liorkesos / Articles controller
Last active August 29, 2015 14:02
Arricles packages
'use strict';
angular.module('mean').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Global', 'Articles',
function($scope, $stateParams, $location, Global, Articles) {
$scope.global = Global;
$scope.hasAuthorization = function(article) {
if (!article || !article.user) return false;
return $scope.global.isAdmin || article.user._id === $scope.global.user._id;
};
├── README.md
├── app.js
├── package.json
├── public
│   ├── assets
│   │   ├── css
│   │   │   └── sonar.css
│   │   └── img
│   │   └── logo.png
│   ├── controllers
{
"name": "mean",
"description": "MEAN.io: A fullstack javascript platformed powerd by MongoDB, ExpressJS, AngularJS, NodeJS.",
"version": "0.3.3",
"private": false,
"author": "Linnovate <[email protected]>",
"contributors": [
{ "name": "Lior Kesos", "mail": "[email protected]" },
{ "name": "Yonatan Ellman", "mail": "[email protected]" },
{ "name": "Ehud Shahak", "mail": "[email protected]" },
<section data-ng-controller="InstallationsController">
<form name="articleForm" class="form-horizontal col-md-6" role="form" data-ng-submit="articleForm.$valid && create()" novalidate>
<div class="form-group">
<label mean-token="'create-title'" class="col-md-3 control-label">Title</label>
<div class="col-md-9">
<input type="text" class="form-control" data-ng-model="title" id="title" placeholder="Title" required>
</div>
</div>
<div class="form-group">
<label mean-token="'create-content'" for="content" class="col-md-3 control-label">Content</label>
@liorkesos
liorkesos / admin.js
Created January 21, 2014 20:42
admin middleware..
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
async = require('async'),
_ = require('underscore');
exports.render = function(req, res) {
if (req.user) {
/**
* Module dependencies.
*/
var express = require('express'),
fs = require('fs'),
passport = require('passport'),
logger = require('mean-logger');
@liorkesos
liorkesos / gist:7482918
Last active December 28, 2015 09:59
brainstorming on the script
#!/bin/bash
curl --silent --write-out '%{http_code}\n' "http://israelhayom.co.il/api/v2/getItems?class_id=1&format=json&order_by=popular&debug=static&real=1"
$(document).ready(function() {
$.get("/0.1/user", function(data) {
window.user = data.user;
window.online = true;
window.bootstrap();
}).fail(function(jqXHR, textStatus, errorThrown) {
var userString = localStorage.getItem('ls.localUser');
window.user = JSON.parse(userString);
window.online = false;