This file contains hidden or 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
f = open(hello_file, 'a+') | |
f.seek(-1,2) | |
if f.read(): | |
path = '\n'+path | |
f.write(path) |
This file contains hidden or 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
def get_username(): | |
return pwd.getpwuid(os.getuid()).pw_name |
This file contains hidden or 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
printf( | |
'<input id="%1$s" name="jo_plugin_options[%1$s]" type="checkbox" %2$s />', | |
'jo_checkbox_del', | |
checked( isset( $this->options['jo_checkbox_del'] ), true, false ) | |
); |
This file contains hidden or 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
$("#frmt").jstree(true).refresh(false, true); |
This file contains hidden or 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
//js code | |
$('.file-field:file').on('change', function() { | |
var file_data = this.files[0]; | |
var form_data = new FormData(); | |
form_data.append('file', file_data); | |
var formUrl = 'upload.php'; | |
$.ajax({ | |
url: formUrl, | |
dataType: 'text', | |
cache: false, |
This file contains hidden or 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
A non-empty zero-indexed array A consisting of N integers is given. Array A represents numbers on a tape. | |
Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. | |
The difference between the two parts is the value of: |(A[0] + A[1] + ... + A[P − 1]) − (A[P] + A[P + 1] + ... + A[N − 1])| | |
In other words, it is the absolute difference between the sum of the first part and the sum of the second part. | |
For example, consider array A such that: |
This file contains hidden or 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
//Previous code | |
a = list(map(int, raw_input().split())) | |
for i in a: | |
if a.count(i) == 1: | |
print i | |
break | |
// Current code | |
from collections import Counter |
This file contains hidden or 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
//Markup | |
<div class="scrollbar" id="style-1"> | |
<div class="force-overflow"></div> | |
</div> | |
//CSS | |
#style-1::-webkit-scrollbar-track | |
{ | |
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); | |
border-radius: 10px; |
This file contains hidden or 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
// For pulling a docker image | |
docker pull <image-name> | |
// For building docker image | |
docker build . | |
// For removing a docker image | |
docker rmi <imageid> | |
// For forcefully removing a docker image |
This file contains hidden or 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
find . -type f -exec grep -l 'data-reactid' {} \; | while IFS='' read -r line; do perl -pi -e 's/(data-reactid=")[^"]+(")/\1\2/g' "$line"; done |