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
UPDATE `Resource` | |
SET FileName = REPLACE(FileName, '/trt/web', '') | |
WHERE FileName LIKE ('/trt/web%'); |
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
# With MySQL login | |
DROP DATABASE dbName; | |
CREATE DATABASE dbName; | |
# Without MySQL login | |
/usr/bin/mysqldump -uuser_name -psecretpassword --add-drop-table database_name | grep ^DROP | /usr/bin/mysql -uuser_name -psecretpassword database_name |
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
var countrySelects = $('[name="addresscountry"], [name="deliverycountry"]'); | |
countrySelects.change(function(e) { | |
countrySelects.val(this.value); | |
}); |
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
$("img").error(function () { | |
$(this).attr('src', '/images/photo-placeholder.jpg'); | |
}); |
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
removePastMonths = function (selectedYear, momentId) { | |
var curYear = (new Date).getFullYear(); | |
var curMonth = (new Date).getMonth(); | |
var monthSelect = $("#doneMomentMonth"); | |
var monthSelectOptions = $("#doneMomentMonth > option"); | |
// If current year is selected, remove past months | |
if (selectedYear == curYear) { |
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 momentImgResize(img, maxWidth, maxHeight) { | |
if (img.data('type') == 'placeholder') { | |
return; | |
} | |
var widthHeightRatio = 1.5; | |
var imgWidth = img.width(); | |
var imgHeight = img.height(); |
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
$monthName = date("F", mktime(0, 0, 0, $monthNum, 10)); |
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
// Source: http://stackoverflow.com/questions/2834353/php-how-do-i-convert-a-server-timestamp-to-the-users-timezone | |
$timestamp = time(); | |
echo 'Unix timestamp: ' . $timestamp; | |
$dt = DateTime::createFromFormat('U', $timestamp); | |
$dt->setTimeZone(new DateTimeZone($timezone)); | |
$adjusted_timestamp = $dt->format('U') + $dt->getOffset(); | |
echo ' Timestamp adjusted for: ' . $timezone . $adjusted_timestamp; |
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
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci; | |
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; |
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
Exec mysql client as root | |
$ mysqld -u mysql --skip-grant-tables & | |
Update your password | |
$ mysql -u root | |
Reload privileges | |
mysql> update mysql.user set password=password('newpassword') where user='root'; | |
Kill mysqld |
OlderNewer