Rocky Jaiswal | Angular.js Hacks A couple of good things happened this week, I got a MacBook Pro (Retina Display) from my generous employer (which I setup promptly after the recent pain Linux distros have been giving me) and I got an underground car parking at work. At 45 degrees, walking back to my car from my office was no easy feat and I am glad that now I've got a cool car (literally) waiting for me when I head home. Also, I have been lucky enough to work on Angular.js for the last two weeks. Initially I was a bit apprehensive to work on it since I have been learning some Backbone.js lately, but then I gave Angular.js one more shot and have been really happy with it. Since I am a CoffeeScript admirer and Backbone.js played really well with CoffeeScript I tried a bit to make Angular.js also work with CoffeeScript. Angular.js and CoffeeScript Controllers Services / Factory Directives I am reasonably pleased with the controller and service code. Animate a view with Angular 1.0.x Well, it worked! with That's it.
Sass: Sass Basics Before you can use Sass, you need to set it up on your project. If you want to just browse here, go ahead, but we recommend you go install Sass first. Go here if you want to learn how to get everything set up. PreprocessingPreprocessing permalink CSS on its own can be fun, but stylesheets are getting larger, more complex, and harder to maintain. This is where a preprocessor can help. Once you start tinkering with Sass, it will take your preprocessed Sass file and save it as a normal CSS file that you can use in your website. The most direct way to make this happen is in your terminal. You can also watch individual files or directories with the --watch flag. sass --watch input.scss output.css You can watch and output to directories by using folder paths as your input and output, and separating them with a colon. sass --watch app/sass:public/stylesheets Sass would watch all files in the app/sass folder for changes, and compile CSS to the public/stylesheets folder. 💡 Fun fact: SCSS Syntax
Why its best practice to inject $rootScope and $controller unit testing controllers? $rootScope has some attached functionality. For example, $broadcast, $emit, $on (probably more than that). As such, supplying your own fakes might not test the actual behaviour. I've found it useful to only mock things that can't be run in a test suite. For example, $window and $http. Thank you for your responses, clarifies some things. Hi Jason i wondered if you could elaborate why using $rootScope. Hi Lior, When I said "pure unit testing", I just meant in terms of Jorge's comment about mocking ALL injectables. Got it. well no need to mock what can run without dependencies (unlike $browser, $http etc).
Grunt pour ceux qui pensent que Grunt est compliqué On parle beaucoup de Grunt aujourd'hui, mais les articles disponibles sont souvent abscons et techniques. Pourtant Grunt n'est pas réservé aux spécialistes, comme le montre cette introduction de Chris Coyier. Par Chris Coyier On donne souvent les conseils suivants aux intégrateurs web : Divisez votre CSS et votre JavaScript en autant de parties que nécessaire, puis concaténez-les pour la version de production de votre site. Il y en aurait encore beaucoup à ajouter, mais voilà déjà quelques basiques. Je suis sûr que vous avez entendu parler de Grunt. Mais soyons clair : Grunt est un de ces nouveaux joujoux à la mode que tous les cool kids utilisent, mais qui à première vue semble étrange et intimidant. Écartons tout de suite quelques malentendus Peut-être avez-vous entendu parler de Grunt mais ne l'avez pas utilisé vous-même. Je n'ai pas besoin de ce que fait Grunt Probablement que si, en fait. Grunt fonctionne avec la console - Je ne suis qu'un designer Je suis designer, moi aussi. grunt
Best practices for unit testing angular directives I'm writing some unit tests for directives in AngularJS using Jasmine and Karma as my test runner. As I'm doing this, I'm wondering whether or not I'm following the best means of setting this up and was hoping someone could help me out. If my directives use a template by means of templateUrl, is it best to import the actual template, which has proved to be a bit tricky, or to insert a mock of the template using $templateCache and make my assertions of of that? For unit testing, it would seem to me that creating mocks would be the best option because it avoids pulling in the additional resources which clutters up the point of unit testing. Also, I'm having trouble searching within individual DOM elements, and have been using element.text() to search for content that is bound to the DOM. Say I have the following element as my template: <div><div id = "one">data1</div><div id = "two">data2</div></div> And I compile it into an angular.element. Thanks
Premiers pas avec Grunt Nous vous conseillons aujourd’hui d’utiliser un gestionnaire de tâches qui nous paraît être mieux sur bien des points: configuration plus souple, lisible et facile et rapidité vous attendent avec Gulp. Vous avez sûrement déjà entendu parler de Grunt à droite à gauche, en conférence, voire votre boite l’utilise déjà mais vous ne savez toujours pas trop ce qui se cache derrière ce terme saugrenu digne d’un personnage de Warcraft. Soit, ce n’est pas bien grave. Grunt est simplement un JavaScript Task Runner, un outil vous permettant de créer des tâches automatisées en JavaScript. Forcément ce n’est pas très parlant mais c’est tout l’intérêt de cet article, vous expliquer ce qu’est Grunt et pourquoi il peut vous être utile dans un workflow de front-end dev. Vous est-il déjà arrivé de devoir régulièrement lancer, lancer et relancer des processus tels que Sass, LESS, uglify - en somme des préprocesseurs ou des minifiers - régulièrement à la main ? Voici un workflow assez classique : $ npm init
Testing Rails App with Testacular and AngularJs Build a real-time polls application with Node.js, Express, AngularJS, and MongoDB Recently while lecturing on HTML5 to a large group of students, I wanted to poll them and display their voting results, updating in real-time. I decided to quickly build a polling app for this purpose. I wanted a simple architecture and not too many different languages and frameworks. So I decided to use JavaScript for everything — Node.js and Express for the server-side, MongoDB for the database, and AngularJS for the front-end user interface. “This MEAN stack (Mongo, Express, Angular, Node) may one day surpass the simplicity of the LAMP stack (Linux, Apache, MySQL, PHP) for web application development and deployment.” I chose to use DevOps Services (formerly JazzHub) to manage the source code for my project. What you'll need to build your app A basic familiarity with Node.js, and a Node.js development environmentThese Node.js modules: Express framework, Jade, Mongoose, and socket.ioAngularJS JavaScript frameworkMongoDB NoSQL databaseThe Eclipse IDE, with the Nodeclipse plug-in installed
modeset/teaspoon Dynamisez vos sites web avec JavaScript ! Bienvenue à toutes et à tous, Qui n'a jamais entendu parler du JavaScript ? Créé dans les années 90 en tant que simple langage de script, JavaScript est désormais un des poids lourds du développement Web ! Qui plus est, il se démocratise au sein d'autres environnements comme les serveurs avec le célèbre Node.js, les applications pour smartphones et tablettes, avec PhoneGap d'Adobe, les applications pour Windows 8, mais aussi les logiciels multiplateformes. Bref, JavaScript est partout ! Mais avant de se targuer de créer des applications pour serveurs, tablettes et Windows, il faut d'abord apprendre la base et s'intéresser aux origines : le JavaScript au sein des pages Web. Voici quelques exemples de ce qui est réalisable grâce au JavaScript : Sur ce, bonne lecture !
testing - How to setup Rails-Angular project to test JS Installing Node.js via package manager | Node.js Note: The packages on this page are maintained and supported by their respective packagers, not the Node.js core team. Please report any issues you encounter to the package maintainer. If it turns out your issue is a bug in Node.js itself, the maintainer will report the issue upstream. Node.js and npm packages are available in the Community Repository. pacman -S nodejs npm Debian and Ubuntu based Linux distributions Also including: Linux Mint, Linux Mint Debian Edition (LMDE), elementaryOS and others. Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea's Launchpad PPA). NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 4.x on older distros. curl -sL | sudo -E bash - sudo apt-get install -y nodejs Alternatively, for Node.js v6: curl -sL | sudo -E bash - sudo apt-get install -y nodejs Available architectures:
angularjs - testacular / karma skips my e2e test