Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created August 7, 2013 00:47
Show Gist options
  • Save brianleroux/6170281 to your computer and use it in GitHub Desktop.
Save brianleroux/6170281 to your computer and use it in GitHub Desktop.
requirebin sketch
// require something
var c = require('caesar-cipher')
var d = c.encrypt(13, 'Hello world')
alert(d)
alert(c.decrypt(13, d))
require=function(r,e,t){function n(t,i){if(!e[t]){if(!r[t]){var c="function"==typeof require&&require;if(!i&&c)return c(t,!0);if(o)return o(t,!0);throw Error("Cannot find module '"+t+"'")}var u=e[t]={exports:{}};r[t][0].call(u.exports,function(e){var o=r[t][1][e];return n(o?o:e)},u,u.exports)}return e[t].exports}for(var o="function"==typeof require&&require,i=0;t.length>i;i++)n(t[i]);return n}({"caesar-cipher":[function(r,e){e.exports=r("jj0kqo")},{}],jj0kqo:[function(r,e){function t(r,e){/^-?\d+$/.test(r)||console.error("Shift is not an integer"),(0>r||r>=26)&&console.error("Shift is out of range");for(var t="",n=e.length,o=0;n>o;o++){var i=e.charCodeAt(o);t+=i>=65&&90>=i?String.fromCharCode((i-65+r)%26+65):i>=97&&122>=i?String.fromCharCode((i-97+r)%26+97):e.charAt(o)}return t}e.exports={encrypt:function(r,e){return t(r,e)},decrypt:function(r,e){return t((26-r)%26,e)}}},{}]},{},[]);var c=require("caesar-cipher"),d=c.encrypt(13,"Hello world");alert(d),alert(c.decrypt(13,d));
<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