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
rgregr |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# Edited by webtempest.com | |
# ====================== Rails examples ===================== | |
# ---------------------- Login Support ------------------------- | |
module LoginSupport | |
# Fake a login for Controller specs | |
def fake_login_as(user) | |
@request.session[:user_id] = user ? user.id : nil |
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
require 'spec_helper' | |
describe "cats/edit" do | |
before(:each) do | |
@cat = assign(:cat, stub_model(Cat, | |
:name => "MyString" | |
)) | |
end | |
it "renders the edit cat form" do |
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
# Libraries used: | |
# jasmine | |
# jasmine-jquery | |
# jasmine-sinon | |
# sinon | |
##### Basics Overview ##### | |
describe "APP_NAME.Views.VIEW_FOLDER.VIEW_NAME ", -> | |
beforeEach -> |
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
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script src="https://raw.github.com/documentcloud/underscore/master/underscore.js"></script> | |
<script src="https://raw.github.com/documentcloud/backbone/master/backbone.js"></script> | |
</head> | |
<body> | |
<div id="app"></div> |
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
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script src="https://raw.github.com/documentcloud/underscore/master/underscore.js"></script> | |
<script src="https://raw.github.com/documentcloud/backbone/master/backbone.js"></script> | |
<script src="https://raw.github.com/tbranyen/backbone.layoutmanager/master/backbone.layoutmanager.js"></script> | |
</head> | |
<body> | |
<div id="app"></div> |
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
{ | |
"login": { | |
"firstForDay": { | |
"coins": 1000, | |
"message": "First login for the day!" | |
}, | |
"firstEver": { | |
"coins": 10000, | |
"message": "First login" | |
} |
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
class App.Models.Assignment.AssignmentTopic extends Backbone.Model | |
loading: -> @get('loading') || false | |
questionsRemainingCount: -> @get('questions_count') - @get('questions_answered_count') | |
questionsRemaining: -> @get('status') == 'try_it_again' || @get('status') == 'in_progress' | |
className: -> (@get('status') || '').replace(/_/g, '-') | |
scores: -> | |
if !@get('scores') || @get('scores').length == 0 | |
i = @get('questions_count') | |
_([0..i]).map(-> { success: false, className: '' }) |
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
class App.Collections.Bundles extends Backbone.Collection | |
url: '...' | |
parse: (results) -> | |
_(results).each (result) -> result.topics_count = result.topic_ids.length | |
results |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer