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
Date.prototype.toMysqlFormat = function() { | |
function twoDigits(d) { | |
if(0 <= d && d < 10) return '0' + d.toString(); | |
if(-10 < d && d < 0) return '-0' + (-1*d).toString(); | |
return d.toString(); | |
} | |
return this.getUTCFullYear() + "-" + twoDigits(1 + this.getUTCMonth()) + "-" + twoDigits(this.getUTCDate()) + " " + twoDigits(this.getUTCHours()) + ":" + twoDigits(this.getUTCMinutes()) + ":" + twoDigits(this.getUTCSeconds()); | |
}; |
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
//@requires jQuery to find width and height of window and creating querystring | |
var href = 'http://twitter.com/share'; | |
var option = { | |
url: 'your location', | |
text: 'your text' | |
}; | |
var width = 575, |
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
var template = '<img style="max-width:100%" src=""></img>'; | |
var imgs = PicListUrl.split('|'); | |
$('body').empty(); | |
for(var i=0; i<imgs.length; i++) { | |
$(template).attr('src',ServerList[server-1]+imgs[i]).appendTo('body'); | |
} |
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
var template = '<img style="max-width:100%" src=""></img>'; | |
var path = getSLUrl(cuD); | |
$('body').empty(); | |
for(var i=0; i<arrFiles.length; i++) { | |
$(template).attr('src',path+arrFiles[i]).appendTo('body'); | |
} |
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
var units = ' KMGTPEZYXWVU'; | |
function toHumanSize(bytes) { | |
if (bytes <= 0) { return 0; } | |
var t2 = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), 12); | |
return (Math.round(bytes * 100 / Math.pow(1024, t2)) / 100) + units.charAt(t2).replace(' ', '') + 'B'; | |
} |
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 . -exec sudo chown www-data.adm {} \; | |
find . -type d -exec sudo chmod 775 {} \; | |
find . -type f -exec sudo chmod 664 {} \; |
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
function(time, local){ | |
(!local) && (local = Date.now()); | |
if (typeof time !== 'number' || typeof local !== 'number') return; | |
var offset = Math.abs((local/1000 - time)), | |
span = [], | |
MINUTE = 60, | |
HOUR = 3600, |
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
1. | |
ssh-keygen -t rsa -f ~/.ssh/id_rsa.work -C "Key for Word stuff" | |
2. | |
touch ~/.ssh/config | |
chmod 600 ~/.ssh/config | |
echo "IdentityFile ~/.ssh/id_rsa.work" >> ~/.ssh/config | |
echo "IdentityFile ~/.ssh/id_rsa.misc" >> ~/.ssh/config | |
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
PicListUrl.split('|').forEach(function(path) { | |
var img = new Image(); | |
img.src = ServerList[server-1]+path; | |
document.body.appendChild(img); | |
}); |
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
//rfc 4122 4.4. Algorithms for Creating a UUID from Truly Random or Pseudo-Random Numbers | |
//@author broofa | |
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);}); |