- Taken from here.
- Bitwise
OR
with0
floors the number it's paired with.- Performance is similar to
Math.floor()
.
- Performance is similar to
- The post highlights it's higher performance to pre-generate random numbers and then loop through them.
// I guess this happens to be the first file which gets included | |
// so I might as well use this to write a message here for whoever | |
// ends up reading this | |
// you're probably gonna be seeing it as one file, but rest assured | |
// (or afraid), that this is actually a compiled file, and I don't | |
// generally scroll through four thousand lines of code in order to | |
// find the valid_img() function. |
- It's still pretty confusing if you ask me and I haven't tested it with routes with params, but as long as it's passed in effectively in the two places, it should be fine.
- See the previous revision for some extended notes on the method flow
- tl;dr
utils.redirectTo()
->Router.route()
->Route.handler()
- tl;dr
Route.handler()
will only callRoute.reverse()
if it receives an object (needed for URL query params) which happens if you leave out theurl
property in the object (first argument) passed intoredirectTo()
.
# Convert `num` into a Number type. | |
parseNumber: (num) -> | |
parseNum = parseInt num, 10 | |
# Throw out strings and floats. | |
if parseNum is +num then parseNum else 0 |
Forgive the sloppy code and structure, I just needed some scaffolding to explain the issue at hand. Assume RequireJS is used for modules.
The way this is implemented now, mixin
will have it's internal variables set to 'privateStuff' rather than 'private', so when the user navigates to the single
action, it won't alert private
.
This is because of how the items are retrieved in the order they are specified and because the closure scope in the mixin is shared between all instances that use it, but preserve essentially the last variable that it was called with.
The problem can be mitigated if the mixins are mixed on initialize
of the models or if the exports
of mixin
curries the methods which use the private properties, so that the variable is bound to the specified option.
module.exports = (grunt) -> | |
grunt.initConfig | |
pkg: grunt.file.readJSON 'package.json' | |
concat: | |
# Stylus doesn't concat well with Bootstrap. | |
css: | |
src: [ | |
'vendor/bower/bootstrap/dist/css/bootstrap.css' |
module.exports = (grunt) -> | |
grunt.initConfig | |
pkg: grunt.file.readJSON 'package.json' | |
docco: | |
local: | |
src: ['src/**/*.coffee', '*.md'] | |
dest: 'public/docs/' | |
public: |
- Here's a [bookmarklet](javascript:(function(){}(a = document.querySelectorAll('[name=approve_button]');([]).forEach.call(a, function(e){e.click();});));) of the script for convenience.
module.exports = (grunt) -> | |
# Requires a `renameBase` property in task config options. | |
flattenPath = (dest, src) -> | |
path = grunt.task.current.data.renameBase | |
# Make files sibling to those in `renameBase`. | |
if src.indexOf(path) is 0 | |
dest + src.slice path.length | |
else | |
dest + src |
- Need to configure
grunt-mocha-blanket
to pass LCOV info over (via https://github.com/alex-seville/blanket/blob/91528273af0fe495fdefd4ef8854d4a8a14ed56c/src/reporters/lcov_reporter.js#L27)- Should be able to pass it in via blanket events (like in the reporter https://github.com/ModelN/grunt-blanket-mocha/blob/063457ffdf4d83861dc01c5eff4f5530dac90964/support/grunt-reporter.js#L69)
- Write the coverage content into a string in the task (somewhere in https://github.com/ModelN/grunt-blanket-mocha/blob/063457ffdf4d83861dc01c5eff4f5530dac90964/tasks/blanket_mocha.js#L99).
- Might need to create a new option for the name of the LCOV file.
- Write to destination with something like https://github.com/kmiyashiro/grunt-mocha/blob/ce7fc530d33cf30fa7cc0f74b346ebc36a2061fe/tasks/mocha.js#L283
- Some initial work seems to be done via GruntBlanketMocha/grunt-blanket-mocha#22