This file contains 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
_.first = function(array, n) { | |
if (n === undefined) { | |
return array[0]; | |
} | |
return slice.call(array, 0, n); | |
}; |
This file contains 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
var call = function(fn, context) { | |
var args = Array.prototype.slice.call(arguments, 2).join(‘,’), | |
result; | |
context.fn = fn; | |
result = eval(“context.fn(“+ args +”)”); | |
delete this.fn; | |
return result; | |
}; |
This file contains 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
_.once = function(func) { | |
var alreadyCalled = false, | |
result; | |
return function() { | |
if(!alreadyCalled) { | |
result = func.apply(this, arguments); | |
alreadyCalled = true; | |
} | |
This file contains 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
var apply = function(fn, context) { | |
var args = Array.prototype.slice.call(arguments, 2), | |
result; | |
context.fn = fn; | |
result = context.fn(args); | |
delete this.fn; | |
return result; | |
}; |
This file contains 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
var bind = function(fn, context) { | |
var args = Array.prototype.slice.call(arguments, 2); | |
return function() { | |
return fn.apply(context, args.concat(Array.prototype.slice.call(arguments))); | |
}; | |
}; |
This file contains 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
// Sign a user in | |
signin: function (user, callback) { | |
var self = this, | |
attributes = { 'sessionId': 'foobar' }; | |
if (typeof(user) == 'function') { | |
callback = user; | |
} |
This file contains 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
describe.only('when user is verified and all fields are valid', function () { | |
var apiUserSession = { | |
sessionId: 'full-sail', | |
user: apiUsers[users.user.api_id] | |
}; | |
given.apiUserCanBeSignedInWith(apiUserSession); | |
given.anExistingApiUserWith(apiUsers[users.user.api_id]); |
This file contains 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 [ | |
'cdn.jquery' | |
'cdn.backbone' | |
'scripts/helpers/common' | |
'scripts/mediator' | |
'site/models/notification' | |
'site/collections/notifications' | |
'site/views/notification_collection' | |
], ($, Backbone, commonHelper, mediator, Notification, Notifications, NotificationCollectionView) -> |
This file contains 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
// Fetch org course | |
$course_api me orgs/121444745/courses | jq '.[] | {"id": .id, "programId": .programId}' | |
{ | |
"id": "qnmizo", | |
"programId": "121444745" | |
} | |
// Create new programId | |
$ course_api me programs post {} | |
{ |
This file contains 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
# The PUT request takes one parameter, a `macros` object that lists the macros to update. | |
# | |
# Each macro must have an id and any of the following parameters: | |
# | |
# | Name | Description | | |
# | -------- | ----------------------------------- | | |
# | id | The ID of the macro to update. | | |
# | active | The new active status of the macro. | | |
# | position | The new position of the macro. | |
OlderNewer