Skip to content

Instantly share code, notes, and snippets.

@kenany
kenany / primality-ls
Last active October 13, 2015 00:58
cd primality && npm ls
[email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
diff --git a/bundle.js b/standalone.js
index 24a4cc2..c20437a 100644
--- a/bundle.js
+++ b/standalone.js
@@ -1,4 +1,5 @@
-require=(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
+(function(e){if("function"==typeof bootstrap)bootstrap("trumpet",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeTrumpet=e}else"undefined"!=typeof window?window.trumpet=e():global.trumpet=e()})(function(){var define,ses,bootstrap,module,exports;
+return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="fu
@kenany
kenany / index.js
Created July 27, 2013 20:12
requirebin sketch
var term = require('hypernal')();
var tablify = require('tablify').tablify;
var elo = require('node-skill').elo;
term.appendTo(document.body);
var termEl = term.term.element;
termEl.style['font'] = '13px Consolas, "Liberation Mono", Courier, monospace';
termEl.style.height = '100%';
termEl.style.padding = '5px';
@kenany
kenany / hyper.js
Last active December 20, 2015 07:49
hyperquest + nock = invincible server
var hyperquest = require('hyperquest');
var through = require('through');
var req = hyperquest.get('http://jsonip.com');
req.pipe(through(write, end));
var data = '';
function write(buf) { data += buf; }
function end() {
data = JSON.parse(data);
ProjectTox-Core\build>cmake -G "MinGW Makefiles" ..
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: g++.exe
CMake Error: your CXX compiler: "g++.exe" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
ProjectTox-Core\build>cmake -G "MinGW Makefiles" ..
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
ProjectTox-Core\build>mingw32-make
Scanning dependencies of target core
[ 5%] Building C object core/CMakeFiles/core.dir/DHT.c.obj
[ 11%] Building C object core/CMakeFiles/core.dir/network.c.obj
[ 17%] Building C object core/CMakeFiles/core.dir/Lossless_UDP.c.obj
[ 23%] Building C object core/CMakeFiles/core.dir/net_crypto.c.obj
[ 29%] Building C object core/CMakeFiles/core.dir/friend_requests.c.obj
[ 35%] Building C object core/CMakeFiles/core.dir/LAN_discovery.c.obj
[ 41%] Building C object core/CMakeFiles/core.dir/Messenger.c.obj
Linking C static library libcore.a
var isCorrectResponse = function(object, file, callback) {
object.should.be.an('object');
require('graceful-fs').readFile(file, 'utf8', function(error, data) {
if (error) return callback(error);
object.should.deep.equal(JSON.parse(data));
callback();
});
};
var assert = require('assert');
var Parser = require('jsonparse');
var p = new Parser();
var r = Math.random();
var times = 20;
while (times--) {
assert.equal(JSON.parse(JSON.stringify(r)), r, 'core JSON');
@kenany
kenany / factor.js
Created August 23, 2013 02:29
least factor with switch-catch
function leastFactor(n) {
switch (false) {
case !(n === 0):
return 0;
case !(n % 1 || n * n < 2):
return 1;
case !(n % 2 === 0):
return 2;
case !(n % 3 === 0):
return 3;