Skip to content

Instantly share code, notes, and snippets.

View gerzhan's full-sized avatar

Nikolay Gerzhan gerzhan

View GitHub Profile

Интсрукция: Разработка на Meteor в Windows с использованием Vagrant

These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).

Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on steps 8 to 15.

If you have no idea what I’m talking about, I’ve made a tutorial to install Ubuntu Precise x86 through Windows command-line with Me

app = angular.module 'BlogExample', []
# Simple controller that loads all blog posts
app.controller 'BlogCtrl', ['$scope', 'Blog', ($scope, Blog) ->
# Get all the blog posts
Blog.all().then (posts) ->
$scope.posts = posts
# Extend the $scope with our own properties, all in one big block
# I like this because it looks like declaring a class.
@section scripts {
<script>
var app = window.app = {};
app.userTypes = @Html.Raw(Json.Encode(Model.GetUserTypes()));
</script>
<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/angular-resource.min.js"></script>
<script src="~/Scripts/underscore.min.js"></script>
<script src="~/Scripts/angular/main.js"></script>
@gerzhan
gerzhan / README.md
Last active August 29, 2015 14:06 — forked from dariocravero/README.md

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

@gerzhan
gerzhan / draggable.js
Last active August 29, 2015 14:07 — forked from siongui/draggable.js
/**
* @see https://github.com/siongui/palidictionary/blob/master/static/js/draggable.js
* @see http://docs.angularjs.org/guide/compiler
*/
angular.module('draggableModule', []).
directive('draggable', ['$document' , function($document) {
return {
restrict: 'A',
link: function(scope, elm, attrs) {

This is an example of the power of the D3 library and how you can use the drag behavior of D3 to control the position and shape of the SVG element.

'use strict';
/**
* @ngdoc module
* @name sails.io
* @file angular-sails-io.js
*
* @description
*
* This file allows you to send and receive socket.io messages to & from Sails
@gerzhan
gerzhan / Example.js
Last active August 29, 2015 14:08 — forked from treyrich/Example.js
angular.module("MyApp", ["SocketProvider"])
.controller("MyController", ["$scope", "socket", function($scope, socket) {
// Fetch initial data
$scope.person = null;
socket.get("/person/1").success(function(data) {
$scope.person = data;
}).error(function() {
@gerzhan
gerzhan / auth.markdown
Last active August 29, 2015 14:09 — forked from mlynch/auth.markdown

Single Page Apps are ruling the world and AngularJS is leading the charge. But many of the lessons we learned in the Web 2.0 era no longer apply, and few are as drastically different as authentication.

CORS

CORS is an oft-misunderstood feature of new browsers that is configured by a remote server. CORS stands for Cross-Origin-Resource-Sharing, and was designed to make it possible to access services outside of the current origin (or domain) of the current page.

Like many browser features, CORS works because we all agree that it works. So all major browsers like Chrome, Firefox, and IE support and enforce it. By using these browsers, you benefit from the security of CORS.

That means certain browsers do not enforce it, so it is not relevant there. One large example is a native Web View for things like Cordova and Phonegap. However, these tools often have configuration options for whitelisting domains so you can add some security that way.

so you'd do something like:

var isAllowedTo = require('../api/policies/isAllowedTo');
module.exports = {
  UserController: {
    create: isAllowedTo('createUser')
  }
}