This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suppose we have following situation | |
$('#dom1').remove(); | |
$('#dom2').remove(); | |
$('#dom3').remove(); | |
$('#dom4').remove(); | |
So, we can write unit test as follows: | |
this.removeStub = sinon.stub($.fn, 'remove'); | |
it('Should remove dom', function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Manual construction of arrays | |
# one dimension array | |
a = np.array([0,1,2,3]) | |
print(a) | |
print ('dimension', a.ndim) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array[start:end:step] # start through not past end, by step | |
start: the beginning index of the slice, it will include the element at this index unless it is the same as end, defaults to 0, i.e. the first index. | |
If it's negative, it means to start n items from the end. | |
end: the ending index of the slice, it does not include the element at this index, | |
defaults to length of the sequence being sliced, that is, up to and including the end. | |
step: the amount by which the index increases, defaults to 1. If it's negative, you're slicing over the iterable in reverse. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suppose we have the following document in users_exams collection: | |
{ | |
"answers" : [ | |
{ | |
"auto_score" : 0, | |
"question_id" : "579733a97e6b58a0616b2c55", | |
"user_answers" : "na", | |
"isCorrect" : false, |