Skip to content

Instantly share code, notes, and snippets.

View igorlima's full-sized avatar
:octocat:
I may be slow to respond.

Igor Ribeiro Lima igorlima

:octocat:
I may be slow to respond.
View GitHub Profile
@igorlima
igorlima / README.md
Last active August 29, 2015 14:03
Artigo Tableless - Gerenciamento de dependências de bibliotecas JavaScript

Gittip Donate Button

Esse artigo é mais um exemplo prático de como gerenciar dependências JS. Para isso vamos utilizar um projeto sem gerenciamento de dependência e aplicar os conhecimentos do artigo publicado no Tableless sobre o Bower. Primeiramente, vamos baixar o projeto:

git clone git@gist.github.com:/69153705256f6a9a4557.git projeto-sem-gerenciamento
cd projeto-sem-gerenciamento

As bibliotecas utilizadas são: Knockout, Zepto, Ratchet JS e Font Awesome. Para gerenciá-las, é preciso criar um arquivo json de configuração.

@igorlima
igorlima / README.md
Last active August 29, 2015 14:16
Get started with Saucie CLI and make easier cross browser testing

Gittip Donate Button

You probably know that to do JavaScript testing is good and one of hurdles to overcome is how to test our code on different browsers. There’re some tools availables for helping us on hurdling this overcome. One of them is a CLI (command line) named saucie developed by igorlima. This CLI is a library hosted on NPM which allows integrate your frontend JavaScript tests with SauceLabs platform. SauceLabs makes awesome cross browser testing, and saucie makes easier that cross browser testing by CLI.

A great interactive JS Test Runner, the testem library, uses saucie on its examples and has the fo

@igorlima
igorlima / README.md
Last active August 29, 2015 14:16
JS unit testing using dependency injection

Gittip Donate Button

JS unit testing using dependency injection

You probably know that to do JavaScript testing is good and some hurdles to overcome is how to test our code in a manner to (i) inject mocks for other modules, (ii) to leak private variables or (iii) override variables within the module.

rewire is a tool for helping us on overcoming these hurdles. It provides us an easy way to dependency injection for unit testing and adds a special setter and getter to modules so we can modify their behaviour for better unit testing. What rewire does is to not load the file and eval the contents to emulate the load mechanism.

To get started with dependency injection, we'll create a twitter rest api server and do unit tests using mocks and overriding variables within modules. This e