Skip to content

Instantly share code, notes, and snippets.

View IsuraManchanayake's full-sized avatar
🏠
Working from home

Isura D. Manchanayake IsuraManchanayake

🏠
Working from home
  • University of Melbourne
  • Melbourne
View GitHub Profile
@Alexx-G
Alexx-G / login.html
Last active January 24, 2022 14:30
Login redirect with user friendly alerts
{% for message in messages %}
{# Login redirect alert.#}
{# We have to display only the last message. Other are irelevant, but must be iterated #}
{% if 'login_required' in message.tags and forloop.last %}
<div class="alert alert-info alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
{{ message }}
</div>
@samwize
samwize / mocha-guide-to-testing.js
Created February 8, 2014 05:53
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()