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
# Usage: <input type="hidden" ng-model="elementid" ng-update-hidden /> | |
.directive 'ngUpdateHidden', -> | |
(scope, el, attr) -> | |
model = attr["ngModel"] | |
scope.$watch model, (nv) -> | |
el.val nv | |
return | |
return |
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
/* | |
* возвращает путь к локальному файлу - thumbnail'у видео с youtube | |
*/ | |
$getYoutubeThumb = function ($videoUrl) { | |
/* | |
* скачивает в кэш thumbnail видео, возвращает полный путь к файлу | |
* Имя файла = md5(url) | |
*/ | |
$downloadPic = function ($srcUrl, $getThumbUrl) { | |
return call_user_func( |
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 параметров | |
getParams = -> | |
query = window.location.search.substring(1) | |
raw_vars = query.split("&") | |
params = {} | |
for v in raw_vars | |
[key, val] = v.split("=") | |
params[key] = decodeURIComponent(val) | |
params |
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
encodeQueryData = (data) -> | |
ret = [] | |
for d of data | |
ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(data[d])) | |
ret.join "&" |
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
$regionsList = array_map("unserialize", array_unique(array_map("serialize", $regionsList))); |
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
# clone git repository | |
git clone --bare repository.git repoclone | |
cd repoclone | |
git push --mirror new-repository.git |
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
### | |
# связанные селекты | |
# secondarySelect всегда disabled кроме след. случаев: | |
# - в primarySelect есть значение | |
# - значение primarySelect != 0 | |
### | |
$.fn.extend | |
bestdiplomSelect: (options) -> | |
@defaultOptions = | |
### пустое значение ### |
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
### | |
# форма со связанными селектами | |
# - стилизация (https://github.com/Dimox/jQueryFormStyler) | |
# - цепляем функционал связанных селектов | |
# - геттеры | |
### | |
$.fn.extend | |
bestdiplomForm: (options) -> | |
@defaultOptions = | |
### селектор, к которому будем применять .styler() ### |
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
### | |
# ajax подгрузка части формы | |
### | |
$.fn.extend | |
bestdiplomAjaxForm: (options) -> | |
@defaultOptions = | |
### основной селект, объект jQuery ### | |
primarySelect: $('#second') | |
loadTo: $('#ajaxload') |