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
describe("display alert for unsaved publisher content", function(){ | |
it('should display confirm dialog if text exists in status message', function(){ | |
$('#status_message_fake_text').val('Hello world'); | |
spyOn(window, 'confirm'); | |
$(window).trigger('confirm') | |
expect(window.confirm).toHaveBeenCalled(); | |
}); | |
}); |
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
$(window).on('beforeunload unload', _.bind(_this._unsavedPublisherWarning, _this)); | |
_unsavedPublisherWarning : function(){ | |
var publisherTextLength = this.el_input.val().trim().length; | |
if(publisherTextLength){ | |
return "navigation_warning"; | |
} | |
} |
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
describe("display alert for unsaved publisher content", function(){ | |
it('should display confirm dialog if text exists in status message', function(){ | |
$('#status_message_fake_text').val('Hello world'); | |
spyOn(window, 'confirm'); | |
$(window).trigger('beforeunload') | |
expect(window.confirm).toHaveBeenCalled(); | |
}); | |
}); |
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
line = " Hello World!! " | |
print line.strip() #remove empty spaces from start and end | |
print line.lstrip() #remove empty spaces from start | |
print line.rstrip() #remove empty spaces from end |
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
mylist = ['apple', 'orange', 'mango'] | |
print ', '.join(mylist) | |
mylist = [1, 2, 3] | |
print str(mylist).strip('[]') | |
mylist = ['1', '2', '3'] | |
print [int(item) for item in mylist] |
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
// pass by ref example | |
#include <iostream> | |
using namespace std; | |
/* | |
store memory address using pointer type variable. | |
int* x : x is a variable to store memory address | |
of another variable. | |
*x : use this syntax to access value from memory address. |
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
#create db | |
create(a{n:"a"}),(b{n:"b"}),(c{n:"c"}),(d{n:"d"}),(e{n:"e"}), | |
a-[:parent_of]->b, | |
a-[:parent_of]->c, | |
b-[:parent_of]->d, | |
d-[:parent_of]->e, | |
e-[:parent_of]->c, | |
d-[:parent_of]->c; | |
#do query |
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
START n=node(*) | |
WHERE has (n.name) | |
and n.name="Google" | |
RETURN n |
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
#count node | |
START n=node(*) | |
RETURN count(n) | |
#count relationship | |
START r=relationship(*) | |
RETURN count(r) |
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
#get all nodes | |
START n=node(*) | |
RETURN n; | |
#delete all nodes | |
MATCH (n) | |
OPTIONAL MATCH (n)-[r]-() | |
DELETE n,r |
OlderNewer