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 db_exists(db_name) { | |
db = db.getSiblingDB('admin'); | |
db.runCommand('listDatabases').databases.forEach(function(db_entry){ | |
if (db_entry.name == db_name) { | |
// quit with exit code zero if we found our db | |
quit(0); | |
} | |
}); | |
// quit with exit code 1 if db was not found |
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
/** | |
* получение курса ЦБРФ | |
* | |
* @param $currency | |
* | |
* @return array | |
*/ | |
private function getCBRFCourse($currency) { | |
$date = getdate(); // получаем ассоциативный массив с данными по дате |
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
<?php | |
/** | |
* класс для работы с робокассой | |
* | |
* PHP version 5.3 | |
* | |
* @author ladamalina | |
* @author Vladimir Chmil <[email protected]> | |
* |
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
/* | |
* form mail + модальное окно при сабмите | |
*/ | |
$.fn.extend({ | |
diplomMailForm: function(data) { | |
countdown = function (element, seconds, minutes) { | |
var interval; | |
minutes = minutes || 0; | |
seconds = seconds || 5; | |
return interval = setInterval(function () { |
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
/* | |
* автоматом отмечает значения, которые пришли в переменных GET | |
* запрос - строка вида worktype=100&second=35 | |
* | |
* Здесь: | |
* worktype - имя и значение option основного селекта | |
* second - имя и значение option зависимого (второго) селекта | |
*/ | |
$.fn.extend({ |
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
TAGS | |
.projectile | |
\#* | |
*~ | |
.#* | |
\#*\# |
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
git filter-branch --commit-filter 'export GIT_AUTHOR_NAME="author" ; export [email protected]; git commit-tree "$@"' |
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
#!/bin/bash | |
EXPECTED_ARGS=3 | |
E_BADARGS=65 | |
MYSQL=`which mysql` | |
Q1="CREATE DATABASE IF NOT EXISTS $1;" | |
Q2="GRANT ALL ON *.* TO '$2'@'localhost' IDENTIFIED BY '$3';" | |
Q3="FLUSH PRIVILEGES;" | |
SQL="${Q1}${Q2}${Q3}" |
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
CREATE DATABASE IF NOT EXISTS dbname; | |
GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost' IDENTIFIED BY 'dbpassword'; | |
FLUSH PRIVILEGES; |
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
$redis = new Redis(); | |
$redis->pconnect('127.0.0.1', 33379); | |
/** | |
* @param $redis | |
* @param string $mask | |
* @param $callback | |
* | |
* @return array|bool | |
*/ |