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
QUnit.module 'Waiter class' | |
test 'Waiter waits for 1 seconds', (assert) -> | |
done = do assert.async | |
waiter = new Waiter() | |
waiter.waitAndReturn -> | |
ok true, 'Timer completed' | |
do done |
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 @Waiter | |
waitAndReturn: (success) -> | |
setTimeout(success, 1000) |
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
QUnit.module 'Person class' | |
test 'Full name is printed correctly', -> | |
person = new Person('James', 'Bond') | |
equal 'James Bond', do person.fullName, 'Full name was printed correctly' |
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 @Person | |
firstName: 'John' | |
lastName: 'Doe' | |
constructor: (@firstName, @lastName) -> | |
fullName: -> | |
return "#{@firstName} #{@lastName}" |
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
# Define the model. | |
class Comment extends Backbone.Model | |
defaults: | |
name: 'test' | |
email: '[email protected]' | |
body: 'BODY' | |
# Define the collection. | |
class CommentCollection extends Backbone.Collection | |
model: Comment |
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
# Define the collection. | |
class CommentCollection extends Backbone.Collection | |
model: Comment | |
# Create a new instance of the collection. | |
comments = new CommentCollection | |
# Add a few comments to the collection. | |
collection.add [ | |
{name: 'Comment 1'}, |
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
# Define the model. | |
class Comment extends Backbone.Model | |
defaults: | |
name: 'test' | |
email: '[email protected]' | |
body: 'BODY' | |
# Create a new instance of the model. | |
comment = new Comment | |
name: 'Overriden name' |
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
# Define the model. | |
class Comment extends Backbone.Model | |
# Create a new instance of the model. | |
comment = new Comment |
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
// Paste this into your console. | |
// Change 'rid' variable value to be the role id you are modifying. | |
var rid = 3; jQuery('input.rid-' + rid).prop('checked', true); |
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
<?php | |
/** | |
* Give admin role permissions to all modules on site. | |
*/ | |
function my_custom_module_update_7001() { | |
$permissions = array(); | |
foreach (module_implements('permission') as $module) { | |
$module_permissions = module_invoke($module, 'permission'); |