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
function PF(){var a=document.createElement("input");this.ips="placeholder" in a;this.init()}PF.prototype._addEvent=function(a,c,b){if(a.addEventListener){a.addEventListener(c,b,false)}else{if(a.attachEvent){a.attachEvent("on"+c,b)}else{a["on"+c]=b}}};PF.prototype.init=function(){var e=this;var b=document.getElementsByTagName("input");for(var d=0,a=b.length;d<a;d++){var c=b[d],g=c.getAttribute("placeholder");if(g&&!this.ips){e._fix(c,g)}e._addChangedProperty(c)}};PF.prototype._addChangedProperty=function(b){var a=this;b.changed=false;b.getValue=function(){return this.changed?this.value:""};if(b.addEventListener){b.addEventListener("input",function(){this.changed=!!this.value},false)}else{b.attachEvent("onpropertychange",function(c){var d=b;c=c||window.event;if(c.propertyName=="value"){d.changed=!!d.value;if(d.changed){ | |
d.style.color="black" | |
}}})}};PF.prototype._setPlaceholderText=function(b,a){b.value=a; | |
b.style.color="#A9A9A9"; | |
b.changed=false};PF.prototype._fix=function(c,a){var b=this;b._setPlaceholderText( |
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.EXITEM = false; | |
var INTERVALID = setInterval(function() { | |
if (!window.EXITEM) { | |
var btn = document.getElementsByClassName('_42ft _42fu _4-s1 _2agf _p _42gx'); | |
if (btn.length) { | |
btn[0].click(); | |
btn[0].remove(); | |
window.EXITEM = true; |
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
function getpoint(d,angle){ | |
return { | |
x: 500 + d * Math.sin(angle * Math.PI/180), | |
y: 300 + d * Math.cos(angle * Math.PI/180) | |
} | |
} | |
for(var i = 0; i<200; i +=2){ | |
for(var a=0; a<=360; a++){ | |
var p = getpoint(i,a); |
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
def make_pagination(paginator, items=4, show_arrows=True, edges=2): | |
""" | |
Returns a list by which a pagination can be prepared in template by simply | |
iterating over it | |
:param paginator: the django paginated queryset. (what you get after paginator.page(.....)) | |
:param items: the number of items to show in center sub-list (place even numbers only) | |
:param show_arrows: show arrows at end and beginning. | |
:param edges: no of items to show at the edges including '...' (set edges=0 to hide ) | |
:return: (sample output) |
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
# sudo apt-get install jpegoptim | |
# sudo apt-get install optipng | |
# jpegoptim -m90 04/*.jpg | |
# optipng 02/sharp_ps2_8x6.png | |
import os | |
import time | |
import glob | |
from subprocess import call | |
from datetime import datetime, timedelta |
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
# sudo apt-get install jpegoptim | |
# sudo apt-get install optipng | |
# jpegoptim -m90 04/*.jpg | |
# optipng 02/sharp_ps2_8x6.png | |
import os | |
import time | |
import glob | |
from subprocess import call | |
from datetime import datetime, timedelta |
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
# sudo apt-get install jpegoptim | |
# sudo apt-get install optipng | |
# jpegoptim -m90 04/*.jpg | |
# optipng 02/sharp_ps2_8x6.png | |
import os | |
import time | |
import glob | |
from subprocess import call | |
from datetime import datetime, timedelta |
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
# Complete the countSpecialElements function below. | |
def countSpecialElements(matrix): | |
items = set() | |
for m, row in enumerate(matrix): | |
min_i, max_i, solution = min_max_in_list(row) | |
if not solution: | |
return -1 | |
# add as row_col | |
items.add('%d_%d' % (m, min_i)) | |
items.add('%d_%d' % (m, max_i)) |
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
# Complete the 'maxPathSum' function below. | |
# | |
# The function is expected to return an INTEGER. | |
# The function accepts following parameters: | |
# 1. 2D_INTEGER_ARRAY board | |
# 2. INTEGER p | |
# 3. INTEGER q | |
# NOTE use a dict to cache the results ro improve performance. |
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
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
# DENOMINATIONS: 5 10 20 50 | |
# BILLS: 4 3 1 1 | |
# withdraw(75): return the number of bills/denomination (e.g.: one bill of 5, one bills of 20, one bill of 50) | |
NOTES = { | |
# 1: 10, | |
5: 4, |
OlderNewer