Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Jensen tjconcept

View GitHub Profile
@tjconcept
tjconcept / index.js
Created Dec 5, 2016
Minimal HTTP server
View index.js
'use strict';
const http = require('http');
const Promise = require('bluebird');
const tell = require('http-tell');
const infer = require('http-infer');
const dispatch = require('http-dispatch');
const a404 = { code: 404 };
View euler-1.js
Array.from({ length: 1000 }, (v, k) => k)
.filter(x => x%3 === 0 || x%5 === 0)
.reduce((t, x) => t + x, 0)
View index.md

If you wish to put the entire fee on your customer, remember that the customer must also pay the fee of collecting the fee itself.

r = 0.025 // (rate fee)
f = 0.25 // (flat fee)

O = 100 // original amount (the cost of some product)

Naive (wrong) approach:

View gist:1db38d286e0710343f24
var supportsCopy;
document.addEventListener('click', onClick);
function canICopy(){
return supportsCopy;
}
function onClick(){
supportsCopy = test();
View gist:95d7ece42d8b0bf2eb17
function canICopy(){
var selection = window.getSelection();
var ranges = [];
var i;
for (i = selection.rangeCount - 1;i >= 0;i--)
ranges.push(selection.getRangeAt(i));
var node = document.createElement('span');
View gist:34b15969008ba273c06f
$ time ./iojs noop.js
real 0m0.154s
user 0m0.142s
sys 0m0.012s
$ time node noop.js
real 0m0.087s
user 0m0.076s
View keybase.md

Keybase proof

I hereby claim:

  • I am tjconcept on github.
  • I am thomasjensen (https://keybase.io/thomasjensen) on keybase.
  • I have a public key whose fingerprint is CC4C DE2E 97F2 EEA0 5C3A C2AE 60BE 7EA0 1EB0 4B01

To claim this, I am signing this object: