Skip to content

Instantly share code, notes, and snippets.

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

Ju8z

🏠
Working from home
View GitHub Profile
Make the test more readable using functional assertions.
Before:
```
@Test
void testStockNegativeRejection() {
try {
inventory.checkStock(-5);
fail("Should have thrown exception");
@Ju8z
Ju8z / gist:5ac4998c3f79fbb5b2bbe3f7bebd49d0
Last active August 17, 2018 09:29
Get URL Parameter.
/**
* Check current URL for parameters: "&parameter=", everything after "=" will be used as VALUE.
*
* @param name URL Parameter Name. For Example userId (in URL ist: &userId=VALUE)
* @returns {*} Parameter VALUE
*/
function getParameter(name) {
url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&')
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),