Permalink
Browse files

optimization, cleanup

  • Loading branch information...
1 parent f588e00 commit 54630b9d8f96670c4589c2b77f6fe9b9564076b4 @elclanrs committed Mar 15, 2014
Showing 301 changed files with 13 additions and 56,508 deletions.
@@ -1 +1,3 @@
+*~
+*.swp
node_modules/
View
@@ -28,21 +28,16 @@
onSlideshowEnd: $.noop
}
, Utils = {
- /**
- * range Get an array of numbers within a range
- * @param min {number} Lowest number in array
- * @param max {number} Highest number in array
- * @param rand {bool} Shuffle array
- * @return {array}
- */
- range: function( min, max, rand ) {
- var arr = ( new Array( ++max - min ) )
- .join('.').split('.')
- .map(function( v,i ){ return min + i })
- return rand
- ? arr.map(function( v ) { return [ Math.random(), v ] })
- .sort().map(function( v ) { return v[ 1 ] })
- : arr
+ // http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript
+ shuffle: function(o) {
+ for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
+ return o;
+ },
+ range: function(min, max, rand) {
+ var out = [];
+ for (var i=min; i<=max; i++) out.push(i);
+ if (rand) return Utils.shuffle(out);
+ return out;
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 54630b9

Please sign in to comment.