Skip to content

Instantly share code, notes, and snippets.

View Ulv's full-sized avatar
🤔
Working

Ulv Ulv

🤔
Working
View GitHub Profile
@Ulv
Ulv / gist:97a6aa5138a6ad96ea40
Created January 12, 2015 12:33
js modal dialog: send mail, countdown and redirect
/*
* form mail + модальное окно при сабмите
*/
$.fn.extend({
diplomMailForm: function(data) {
countdown = function (element, seconds, minutes) {
var interval;
minutes = minutes || 0;
seconds = seconds || 5;
return interval = setInterval(function () {
@Ulv
Ulv / Robokassa.php
Created November 8, 2014 11:53
Класс для работы с робокассой с обновлением курса с ЦБРФ для yii
<?php
/**
* класс для работы с робокассой
*
* PHP version 5.3
*
* @author ladamalina
* @author Vladimir Chmil <vladimir.chmil@gmail.com>
*
@Ulv
Ulv / Robokassa.php
Created November 8, 2014 11:42
Получение курса ЦБРФ
/**
* получение курса ЦБРФ
*
* @param $currency
*
* @return array
*/
private function getCBRFCourse($currency) {
$date = getdate(); // получаем ассоциативный массив с данными по дате
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
@Ulv
Ulv / script.coffee
Created August 30, 2014 12:48
ajax load joomla rsform
###
# ajax подгрузка части формы
###
$.fn.extend
bestdiplomAjaxForm: (options) ->
@defaultOptions =
### основной селект, объект jQuery ###
primarySelect: $('#second')
loadTo: $('#ajaxload')
###
# форма со связанными селектами
# - стилизация (https://github.com/Dimox/jQueryFormStyler)
# - цепляем функционал связанных селектов
# - геттеры
###
$.fn.extend
bestdiplomForm: (options) ->
@defaultOptions =
### селектор, к которому будем применять .styler() ###
@Ulv
Ulv / script.coffee
Created August 30, 2014 12:45
linked selects in coffeescript
###
# связанные селекты
# secondarySelect всегда disabled кроме след. случаев:
# - в primarySelect есть значение
# - значение primarySelect != 0
###
$.fn.extend
bestdiplomSelect: (options) ->
@defaultOptions =
### пустое значение ###
@Ulv
Ulv / gist:bb2ff2d1f3afec36b6db
Created June 27, 2014 07:00
clone git repository
# clone git repository
git clone --bare repository.git repoclone
cd repoclone
git push --mirror new-repository.git
@Ulv
Ulv / worldmapController.class.php
Created June 17, 2014 12:48
array_unique for multidimensional array
$regionsList = array_map("unserialize", array_unique(array_map("serialize", $regionsList)));
@Ulv
Ulv / script.coffee
Created June 14, 2014 14:34
coffeescript encode query string
encodeQueryData = (data) ->
ret = []
for d of data
ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(data[d]))
ret.join "&"