Skip to content

Instantly share code, notes, and snippets.

var $window = $(window),
resizeInCooldown = false,
resizeTimeout;
function onResize() {
var resizeValue;
// only run this if we didn't run a update 150ms ago or less.
if ( !resizeInCooldown ) {
// orientation dictates what height and what width means.
<responsive>
<div ng-switch='screenSize'>
<div ng-switch-when='small'>
<h1>Small Screen</h1>
</div>
<div ng-switch-when='medium'>
<h1>Medium Screen</h1>
</div>
<div ng-switch-when='large'>
<h1>Large Screen</h1>
/* Check the file content
//var filename = FileHandler.getFileName();
// FileHandler.checkRateFile();
// current use:
FileHandler.checkRateFile(function(counter) {
$scope.counter = counter;
console.log('$scope.counter: '+$scope.counter);
});
'use strict';
angular.module('app')
.factory('Flags',
function Flags() {
var exports = {};
var UA = navigator.userAgent,
isIOS = /ip(hone|od|ad)/i.test(UA),
isSafari = /(mac os x).*version\/\d(.\d)+ (mobile\/\w{5,} )?safari/i.test(UA),
isSafari5 = /(mac os x).*version\/5[.\d]+ (mobile\/\w{5} )?safari/i.test(UA),

This gist is in response to a question asked on the Reddit Angular JS forum about how to structure an Angular app with roles and permissions.

There are many ways to approach this, but I'll share one that I've used before and maybe it will give you an idea. I'd combine all of the above into a single app and control who gets to see what using permissions. There are a few components to this approach...

A local session service

First off I'd advise creating some sort of local session management service. This should be able to track whether you have an authenticated user and- if so- what types of permissions that user has. (Lots of ways to manage permissions. I'll assume your user object has either a 'role' enum or something simple like an array of string permissions.) You could roll your own session service or you could check out something like satellizer.

Let's assume yo

Links úteis

  • A Rant about Estimation – When Will We Stop Being Crazy

  • InfoQ BR

    • Fuja da escravidão antes que ela te alcance - Nesta palestra, Vinícius Teles nos fala a respeito da realidade de muitos trabalhadores que possuem vidas estáveis, porém repletas de frustrações advindas de suas rotinas e carreiras aparentemente seguras. Vinícius trata do empreendedorismo, com dicas para profissionais de tecnologia que buscam atingir não apenas a estabilidade financeira, mas também a plena satisfação profissional e pessoal.

    • Agile Brazil 2012

@StanShumsky
StanShumsky / 1.js
Last active August 29, 2015 14:21 — forked from ToeJamson/1.js
$scope.subscribe = function() {
...
PubNub.ngSubscribe({
channel: theChannel,
state: {
"firstName" : $scope.user.firstName,
"lastName" : $scope.user.lastName,
"favoriteColor" : $scope.user.faveColor
}
});
var http = require('http')
, bl = require('bl')
, urls = process.argv.slice(2)
function httpGet(url) {
return new Promise(function (resolve, reject) {
http.get(url, function (response) {
response.pipe(bl(function (err, data) {
if (err) reject(err)
resolve(data.toString())
/**
* @ngdoc directive
* @name ng.directive:ngApp
*
* @element ANY
* @param {angular.Module} ngApp an optional application
* {@link angular.module module} name to load.
*
* @description
*
@StanShumsky
StanShumsky / introrx.md
Created November 25, 2015 07:47 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing