One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
// ================================== | |
// linear regression trainer in rust | |
// @author 6174 | |
// ================================== | |
// use std::cell::RefCell; | |
use std::vec::Vec; | |
fn main() { | |
// linear_regression(); |
var uniqueArray = function(arrArg) { | |
return arrArg.filter(function(elem, pos,arr) { | |
return arr.indexOf(elem) == pos; | |
}); | |
}; | |
var uniqEs6 = (arrArg) => { | |
return arrArg.filter((elem, pos, arr) => { | |
return arr.indexOf(elem) == pos; | |
}); |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
var Middleware = function() {}; | |
Middleware.prototype.use = function(fn) { | |
var self = this; | |
this.go = (function(stack) { | |
return function(next) { | |
stack.call(self, function() { | |
fn.call(self, next.bind(self)); | |
}); |
// Asynchronous implementation with JDK 1.8: | |
public static void setTimeout(Runnable runnable, int delay){ | |
new Thread(() -> { | |
try { | |
Thread.sleep(delay); | |
runnable.run(); | |
} | |
catch (Exception e){ | |
System.err.println(e); | |
} |
//main function for creating an inline worker: | |
//inlineWorker:: Function -> a -> Promise b | |
const inlineWorker = fn => msg => { | |
const scriptString = `const func = ${fn.toString()}; | |
addEventListener('message', function(e) { | |
Promise.resolve(e.data) | |
.then(func) | |
.then(postMessage); | |
}, false); | |
`; |
/** | |
* Copyright 2016 Google Inc. All rights reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
// To learn more about the halting problem check out Gary Bernhardt's series on computation | |
https://www.destroyallsoftware.com/screencasts | |
// Ethereum Yellow Paper | |
http://gavwood.com/paper.pdf | |
// Ethereum OpCodes List | |
http://ethereum.stackexchange.com/questions/119/what-opcodes-are-available-for-the-ethereum-evm | |
// Ethereum OpCodes Gas Costs |
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))) | |
// Usage : compose functions right to left | |
// compose(minus8, add10, multiply10)(4) === 42 | |
// | |
// The resulting function can accept as many arguments as the first function does | |
// compose(add2, multiply)(4, 10) === 42 |