Skip to content

Instantly share code, notes, and snippets.

View a-ignatov-parc's full-sized avatar

Anton Ignatov a-ignatov-parc

View GitHub Profile
$(window).bind('calculator:rendered', function(event, route) {
alert('Только что отрисовалась страница' + route);
});
initialize: function(initData) {
Plc
// Создаем источники данных
.set('User', {
view: NO,
initData: initData.User
})
// Пример использования источника данных как вью-модели
.set('Header', {
@a-ignatov-parc
a-ignatov-parc / index.html
Created March 22, 2012 05:43
Укороченная версия главной страницы ЛК Ренисанса
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head>
<title>Ренессанс</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
...
<link href="/" rel="home">
<link href="@Url.Content("~/Content/static/css/main.css")" type="text/css" rel="stylesheet" />
...
parse: function(response, xhr) {
xhr.userData || (xhr.userData = {});
var actionName = xhr.userData.action,
actionList = {
do_action: function(data, xhr) {
console.log('sended data', xhr.userData.sendedData);
}
},
action = actionList[actionName || this.action] || function() {};
Calc.requestWraper(this.model, 'send', data, {
action: 'do_action',
options: {
success: function(model, response) {
// code here
}.bind(this)
}
});
target.mask(mask.toString(), {
onFocus: this.processPlaceholder.bind(this),
onBlur: this.processPlaceholder.bind(this),
sanity: function(val) {
// Перед началом ввода сбрасываем все ошибки контрола если они есть
Calc.validateControl({
currentTarget: target[0],
type: 'reset'
});
switch (data.name) {
case 'UserName':
break;
case 'Email':
if (!this.validateEmail(data)) {
isValid = NO;
}
break;
case 'Password':
field = $('input[name=' + data.name + ']', form);
// Метод для проверки валидации контрола. В качестве принимается id валидаторв привязанный при создании
checkValidation: function(event, canShowErrors) {
// Валидаторы по номерам
var validatorsFn = this.validatorsFn,
control = event.currentTarget,
$control = $(control),
value = control.value,
isRadio = control.type == 'radio',
isSelect = control.tagName.toLowerCase() == 'select',
acceptedEvents = {
Validators: [
{
Enabled: true,
ErrorMsg: '',
IsValid: true,
Method: 11,
Params: {}
},
{
Enabled: true,
@a-ignatov-parc
a-ignatov-parc / hack.sh
Created April 2, 2012 11:22 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#