Skip to content

Instantly share code, notes, and snippets.

View ivan-hilckov's full-sized avatar
🤔

Ivan Hilkov ivan-hilckov

🤔
View GitHub Profile
$.when(
$.ajax({
type: 'GET',
data: { webname: data_review.webname },
url: get_url,
dataType: 'json'
}),
$.ajax({
type: 'GET',
data: data_review,
@ivan-hilckov
ivan-hilckov / loyut.coffee
Created July 10, 2012 13:59
loyut.coffee
class Loyut extends Backbone.View
initialize: =>
app.on( @name + ':open', (el) =>
if el.name is @name
el.open()
)
app.on( @name + ':close', (el) =>
if el.name is @name
el.close()
)
@ivan-hilckov
ivan-hilckov / faq.coffee
Created July 10, 2012 14:00
faq.coffee
class Faq extends Loyut
name: 'faq'
url: 'faq'
el: $('.b-popup_faq')
$ ->
app.loyut.faq = new Faq
app.router.set(app.loyut.faq)
app.menu.top.set(app.loyut.faq)
# # Меню Menu
# Связывает текущий экран и пункт меню ( через урл )
class window.Elections.Menu extends Backbone.View
events:
"click li" : "openMenuItem"
@init: ( params ) ->
new this( params )
suite "Election.Menu", ->
setup ->
@menu = Elections.Menu.init( el: ".some-class", app: { on: sinon.stub() } )
test "инициализируеться", ->
assert.isObject( @menu )
suite "Election.Menu", ->
setup ->
@app = new Elections.App
@menu = Elections.Menu.init( el: ".menu", app: @app )
sinon.spy( @menu, "activateMenuItem" )
sinon.spy( @menu, "deactivateMenuItem" )
test "событие viewOpen", ->
suite "Elections.Router", ->
setup ->
@router = new Elections.Router( @window = sinon.stub() )
test "gotoUrl with url", ->
url = "route2"
@router.gotoUrl(url)
assert.equal @window.location, url
@ivan-hilckov
ivan-hilckov / gist:3177393
Created July 25, 2012 17:25 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@ivan-hilckov
ivan-hilckov / model_openid_test.coffee
Created July 26, 2012 12:45
model_openid_test.coffee
class Elections.Model.Openid extends Elections.Model.Base
url: "/auth/open_id"
validation:
openid_url: [{
required: true
pattern: /^(https?:\/\/)?([\w\.]+)\.([a-z]{2,6}\.?)(\/[\w\.]*)*\/?$/
msg: "Введите OpenID"
}]
# # Openid Model
# Валидирует и отправляет форму на сервер
class Elections.Model.Openid extends Elections.Model.Base
url: "/auth/open_id"
validation:
openid_url: [{