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 collections | |
def my_sort(d1, d2): | |
if d1[1] > d2[1]: | |
return -1 | |
elif d1[1] < d2[1]: | |
return 1 | |
else: | |
if d1[0] > d2[0]: | |
return 1 |
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
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
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
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 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( |
NewerOlder