Skip to content

Instantly share code, notes, and snippets.

View No9's full-sized avatar
🦀
Rusting with a slight chance of code

Anton Whalley No9

🦀
Rusting with a slight chance of code
View GitHub Profile
@No9
No9 / hyperscript.js
Last active August 29, 2015 14:24
A tongue in cheek implementation of hyperscript to illustrating a 'pure ui' approach
// Based on http://rauchg.com/2015/pure-ui/
var h = require('hyperscript')
function dashboard(opts){
// with proper access to the layout data
// data CSS media queries can be redundant
if (opts.width > 375) {
return h('div', 'Twitter followers ' + opts.num)
} else {
return h('div', 'Twitter followers ' + (opts.num / 1000) + 'K')
Hours in a year 8765
On demand
$0.154 / Hour = 8765
8765 * 0.127 = 1113.155
$220 $0.127 per Hour 1,349.81 for a Medium Instance
@No9
No9 / host-multiaction.js
Created April 16, 2014 13:21
A POC for issue. Save it in the test folder next to host.js
var test = require("tap").test;
var assert = require('assert');
var http = require('http');
var httpProxy = require('http-proxy');
// Create an array of selects that harmon will process.
var actions = [];
// Create a simple action
@No9
No9 / index.js
Last active December 18, 2015 08:39
Current levelweb connection
///AS IS
db.usrdb = multilevel.client()
db.usrdb.pipe(protocol.connect(opts.client, opts.host, function() {
console.log(location)
})).pipe(db.usrdb)
//TO BE
var r = reconnect(function (stream) {
db.usrdb = multilevel.client(require(opts.clientmanifest))
stream.pipe(db.usrdb).pipe(stream)

The browser field is provided by a module author as a hint to javascript bundlers or component tools when preparing modules for client side use.

terms

Below are common terms used in the rest of the document

server

This is a non-dom based javascript execution environment. It usually only contains the base javascript language spec libraries and objects along with modules to communicate with OS features (available through commonjs require).

client

;(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){
var leveldowngap = require('leveldown-gap')
, levelup = require('levelup')
, factory = function (location) { return new leveldowngap(location) }
, db = levelup('/does/not/matter', { db: factory })
db.put('name', 'Yuri Irsenovich Kim')
db.put('dob', '16 February 1941')
db.put('spouse', 'Kim Young-sook')
db.put('occupation', 'Clown')
@No9
No9 / hacks.js
Created April 30, 2013 01:54 — forked from notmasteryet/hacks.js
(function() {
try {
var a = new Uint8Array(1);
return; //no need
} catch(e) { }
function subarray(start, end) {
return this.slice(start, end);
}
@No9
No9 / LevelDBWindowsTestOutput
Created March 30, 2013 11:49
All seem to be filelock related.
==== Test ArenaTest.Empty
==== Test ArenaTest.Simple
==== PASSED 2 tests
==== Test BloomTest.EmptyFilter
==== Test BloomTest.Small
==== Test BloomTest.VaryingLengths
False positives: 0.23% @ length = 1 ; bytes = 9
False positives: 0.44% @ length = 2 ; bytes = 9
False positives: 0.75% @ length = 3 ; bytes = 9
False positives: 1.08% @ length = 4 ; bytes = 9
@No9
No9 / MSBUILD.reg
Created March 22, 2013 10:39
A copy of my MSBuild.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\3.5]
"DefaultToolsVersion"="2.0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\4.0]
"DefaultToolsVersion"="2.0"
"MSBuildOverrideTasksPath"="C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\"
@No9
No9 / VCTargetsPath.reg
Last active December 15, 2015 06:59
Reg file that cured error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. VCTargetsPath.reg is all that should be required
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\4.0]
"VCTargetsPath"="$(MSBuildExtensionsPath32)\\Microsoft.Cpp\\v4.0\\"