Skip to content

Instantly share code, notes, and snippets.

View gerzhan's full-sized avatar

Nikolay Gerzhan gerzhan

View GitHub Profile
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
var app = angular.module('app', ['ngResource']);
app.config(function($locationProvider, $routeProvider) {
// $locationProvider.html5Mode(true);
$routeProvider
.when('/', { templateUrl: 'partials/index', controller: 'ctrl' })
.when('/about', { templateUrl: 'partials/about', controller: 'ctrl' })
.otherwise({redirectTo:'/'});
});
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
# Factories are used to give each class it's own dependency management
angular.module('myApp', ['ngCookies'])
.factory('BaseObject', ['$log', '$http', ($log, $http) ->
# The instance-classes are returned at the end of the factory and can be injected (unmodified)
class BaseObject
constructor: (@options) ->
send: (args) ->
$log.log('sending', args)
$http(args)
app.directive("uiSrefParams", function($state) {
return {
link: function(scope, elm, attrs) {
var params;
params = scope.$eval(attrs.uiSrefParams);
return elm.bind("click", function(e) {
var button;
if (!angular.equals($state.params, params)) {
button = e.which || e.button;
if ((button === 0 || button === 1) && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
@gerzhan
gerzhan / jsdoc.coffee
Last active August 29, 2015 14:04 — forked from Layzie/jsdoc.coffee
### define function variable before block to avoid code being appended to closing part of JSDoc comment ###
cube = ''
###*
# Funtion to calculate cube of input
# @param {number} Number to operate on
# @return {number} Cube of input
###
cube = (x) -> x*x*x
@gerzhan
gerzhan / app.js
Created August 14, 2014 16:34 — forked from shazron/app.js
requirejs(['cordova.js'],
function () {
// start of require
// cordova is now available globally
var exec = cordova.require('cordova/exec');
var app = {
// Application Constructor
@gerzhan
gerzhan / gist:85872a2acf4e42a18f07
Created August 20, 2014 01:15
AutoScrool by event
app.run(['$rootScope',function($rootScope) {
$rootScope.$on('$viewContentLoaded', function(e) {
jQuery('html, body').animate({scrollTop: 0}, 200);
});
}]);
var HEADER_NAME = 'MyApp-Handle-Errors-Generically';
var specificallyHandleInProgress = false;
angular.module('myApp').factory('RequestsErrorHandler', ['$q', function($q) {
return {
// --- The user's API for claiming responsiblity for requests ---
specificallyHandled: function(specificallyHandledBlock) {
specificallyHandleInProgress = true;
try {
return specificallyHandledBlock();