made with requirebin
Created
July 17, 2014 19:03
-
-
Save knownasilya/954fa6dab4e7c6822fa6 to your computer and use it in GitHub Desktop.
requirebin sketch
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
var pair = require('pair-me-up'); | |
var pairs = pair(1, 30); | |
// For demo purposes | |
var list = document.createElement('ul'); | |
pairs.forEach(function (pair) { | |
var item = document.createElement('li'); | |
item.textContent = pair.join(', '); | |
list.appendChild(item); | |
}); | |
document.body.appendChild(list); |
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
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({MiBwFj:[function(require,module,exports){"use strict";var range=require("range");module.exports=function(start,end){var pairRange=range(start,end+1);var getRandom=randomRange(start,end);var result=[];var paired={};pairRange.forEach(function(start){var random=start;while(random===start){random=getRandom();if(paired[random]){random=start}}paired[random]=true;result.push([start,random])});return result};function randomRange(min,max){max+=1;return function(){return Math.floor(Math.random()*(max-min))+min}}},{range:3}],"pair-me-up":[function(require,module,exports){module.exports=require("MiBwFj")},{}],3:[function(require,module,exports){exports=module.exports=range;function range(a,b,step){if(!step){step=1}var r=[];for(var x=a;x<b;x+=step){r.push(x)}return r}exports.range=range},{}]},{},[]);var pair=require("pair-me-up");var pairs=pair(1,30);var list=document.createElement("ul");pairs.forEach(function(pair){var item=document.createElement("li");item.textContent=pair.join(", ");list.appendChild(item)});document.body.appendChild(list); |
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
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"pair-me-up": "0.0.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
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment