Skip to content

Instantly share code, notes, and snippets.

View Ni55aN's full-sized avatar

Vitaliy Stoliarov Ni55aN

View GitHub Profile
function primeFactors(n){
var list = [];
var maxi=9999999;
var maxk=99;
for(var i=2;n>1;i++){
var m = null;
for(var k=1;;k++){
var d = n/Math.pow(i,k);
function queueTime(customers, n) {
var sorted = customers.sort((a,b)=>b-a);
var max = Math.max(...sorted);
var tills = Array(n).fill(0);
while(sorted.length>0){
for(var i=0;i<n && i<sorted.length;i++)
{
tills[i] += sorted.shift();
}
export class FrameQueue {
constructor(method) {
this.queue = [];
this.method = method;
this.ondone = null;
}
add() {
this.queue.push(this._f.apply(this, arguments));
function _avg(x){
return x.reduce((a,b) => a+b,0)/x.length;
}
function _avgK(x, k){
var N = x.length;
var Nk = N-k;
return x.slice(0, Nk).reduce((a,b) => a+b,0)/Nk;
}
{
"parser": "babel-eslint",
"rules": {
"comma-dangle": [1, "never"],
"no-cond-assign": 1,
"no-console": 1,
"no-constant-condition": 1,
"sort-imports": "warn",
"no-duplicate-imports": "warn",
"no-control-regex": 1,
delegate Color pixelMap(Color c);
delegate void pixelEach(Color c);
abstract class MyBitmap
{
protected Bitmap bmp;
public abstract Color getPixel(int x, int y);
public abstract void setPixel(int x, int y, Color color);
public abstract void Save();
var AssociationRules = function(transactions, MIN_SUPPORT, MAX_COMBINATION) {
var getOptions = function(data) {
var set = new Set();
data.map(function(el) {
el.map(function(val) {
if (val != null)
set.add(val);
});
});
var head = ['Різновидність лісових угідь', 'Різновид вологості ґрунту', 'Температура повітря ', 'Рівень пожежної безпеки'];
var data = [
['Листові', 'Низька', '20', '1'],
['Листові', 'Низька', '30', '3'],
['Листові', 'Низька', '40', '5'],
['Листові', 'Середня', '20', '1'],
['Листові', 'Середня', '30', '2'],
['Листові', 'Середня', '40', '4'],
['Листові', 'Висока', '20', '1'],
['Листові', 'Висока', '30', '3'],
@Ni55aN
Ni55aN / table2js.lua
Created February 12, 2017 19:02
This function converts Lua table to JS object using lua.vm.js
function table2js(t)
local type = type(t)
if type == "number" or type == "string" then
return t
end
if not (t[1] == nil) then -- check "t" is array
@Ni55aN
Ni55aN / OpenCV Feature2D.cpp
Last active April 18, 2017 17:43
ORB vs SURF
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <ctime>
#include <math.h>
#include <fstream>
#include <opencv2/core.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/highgui.hpp>