Note that the assert object is not chainable. Link to assert docs.
-
assert(expression, message) -
assert.fail(actual, expected, [message], [operator]) -
assert.ok(object, [message])
| // Adds pluckRef method to lodash | |
| // Example: _.(array, 'key1.key2.key3'); | |
| // Goes through each object of the array and attempts to pluck objects that are | |
| // in the specified object chain path. It filters away undefined values. | |
| _.mixin({ | |
| 'pluckRef': function(arr, keyPathRef) { | |
| var i, j, keys, key, ref, output = []; | |
| keys = keyPathRef.split('.'); | |
| // for each object in the array |
| @mixin keyframesteps($name, $steps, $startx, $endx) { | |
| @keyframes #{$name} | |
| { | |
| @for $i from 0 through $steps { | |
| $diff: ($endx - $startx) / $steps; | |
| #{($i/$steps*100)}% { | |
| $x: ($i * $diff) + $startx; | |
| background-position: $x 0; | |
| } | |
| } |
Note that the assert object is not chainable. Link to assert docs.
assert(expression, message)
assert.fail(actual, expected, [message], [operator])
assert.ok(object, [message])
| // Needs RequireJS's `require` and mocha's `before` | |
| /** | |
| * Works like mocha's `before` function but enables you to load in dependencies | |
| * as well. | |
| * | |
| * @param deps [Array] the dependencies passed on to RequireJS | |
| * @param callback [Function] the callback with loaded dependencies as arguments | |
| */ | |
| requireBefore = function(deps, callback) { |
| /** | |
| * Generates normally distributed random numbers | |
| */ | |
| function normalRandom(mean, stdDev) { | |
| // Generate a "close enough" uniform random | |
| // number w. mean = 0 and std.dev = 1 | |
| var uniformRandom = (Math.random()*2-1)+(Math.random()*2-1)+(Math.random()*2-1); | |
| return Math.round(uniformRandom * stdDev + mean); | |
| } |
| var Errors = Reflux.createActions(['error1', 'error2' /*, 'error3' */]); | |
| var ErrorNotificationStore = Reflux.createStore({ | |
| init: function() { | |
| _.each(Errors, function(action) { | |
| this.listenTo(action, this.onError); | |
| }, this); | |
| }, | |
| onError: function(errorMessage) { | |
| /* whatever you want to do with errorMessage and this.trigger(...) */ |
| # Description: | |
| # Hubot delivers a fika related pic | |
| # | |
| # Dependencies: | |
| # cron | |
| # google-images | |
| # | |
| # Configuration: | |
| # None | |
| # |
| # Description: | |
| # Hubot make me a sandwich | |
| # | |
| # Dependencies: | |
| # google-images | |
| # | |
| # Configuration: | |
| # None | |
| # | |
| # Commands: |
| # Description: | |
| # Hubot delivers a pic from Reddit's /r/holdmybeer frontpage if it is a friday | |
| # based on the aww script. | |
| # | |
| # Dependencies: | |
| # moment | |
| # | |
| # Configuration: | |
| # None | |
| # |
| /** | |
| * # Post messages using Slack's Webhook | |
| * | |
| * Use this in combination with node-cron to Schedule messages. | |
| * No need to have the hubot invited on the actual channel to post. | |
| * | |
| * ## Dependencies | |
| * | |
| * superagent | |
| * lodash |