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
// CollectionView + ItemView example | |
var MySubView = Marionette.ItemView.extend({ | |
"triggers": { | |
"click .save": "widget:saved" | |
} | |
}); | |
var MyCollectionView = Marionette.CollectionView.extend({ | |
"initialize": function(options) { |
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
165 def testUnableToRemoveOwnerProjectAccess(self): | |
166 try: | |
167 raise barrister.RpcException(40, "dingle") | |
168 except barrister.RpcException as e: | |
169 assert e.code == 40 | |
// |
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
def assertUserValidationException(fx): | |
def decorator(fx): | |
try: | |
fx() | |
except barrister.RpcException as e: | |
assert e.code == 1002 | |
else: | |
assert False, "Should have thrown an RpcException with status code 1002" | |
return decorator |
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
app.get('/proxied_image/:image_url', function(request_from_client, response_to_client){ | |
sys.puts("Starting proxy"); | |
var image_url = request_from_client.params.image_url; | |
var image_host_name = url.parse(image_url).hostname | |
var filename = url.parse(image_url).pathname.split("/").pop() | |
var http_client = http.createClient(80, image_host_name); | |
var image_get_request = http_client.request('GET', image_url, {"host": image_host_name}); | |
image_get_request.addListener('response', function(proxy_response){ |
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
window.BaseListView = window.BaseView.extend({ | |
close: function() { | |
this._closeAllSubViews(); | |
window.BaseView.prototype.close.call(this); | |
}, | |
initialize: function(options) { | |
this._subViews = []; | |
this.collection.on("add", this._renderSubView, this); | |
this.collection.on("reset", this._renderSubViews, this); | |
this.collection.on("remove", this._closeSubView, this); |
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
// defining attr_accessor on singleton Class instance of Foo | |
class Foo | |
class << self | |
attr_accessor :color | |
end | |
end | |
// not threadsafe |
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
######## | |
# app.rb | |
# | |
require 'sinatra' | |
set :root, File.dirname(__FILE__) | |
enable :sessions |
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
######## | |
# app.rb | |
# | |
require 'sinatra/base' | |
class SimpleApp < Sinatra::Base | |
set :root, File.dirname(__FILE__) |
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
########### | |
# config.ru | |
# | |
require File.dirname(__FILE__) + '/app' | |
run SimpleApp |
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
######## | |
# app.rb | |
# | |
require 'sinatra/base' | |
class SimpleApp < Sinatra::Base | |
set :root, File.dirname(__FILE__) |