Skip to content

Instantly share code, notes, and snippets.

Avatar

Rui Alves iursevla

View GitHub Profile
View Tampermonkey Script for CoinMarketCap
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://coinmarketcap.com/
// @grant none
// ==/UserScript==
@iursevla
iursevla / Test.html
Created May 23, 2017
Test usage of Papa Parser 4
View Test.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Novo Parser</title>
<script src="papaparse.js"></script>
<script src="Test.js"></script>
View CSVParser.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>CSV Parser</title>
<script src="CSVParser.js"></script>
</head>
@iursevla
iursevla / worker.js
Last active May 21, 2017
CSV process worker
View worker.js
let numMsgsReceived = 0; //Number messages received
let options = null; //Save options
let headerIndeces = []; //Indeces of header to save
/**
* Receive options and file to read from main Thread.
*/
this.onmessage = function (e) {
if (numMsgsReceived === 0) { //Save options
options = e.data;
View rtree.js
/**
* Exports a `PolygonLookup` constructor, which constructs a data-structure for
* quickly finding the polygon that a point intersects in a (potentially very
* large) set.
*/
var pointInPolygon = function (point, vs) {
// ray-casting algorithm based on
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
View html5-video-streamer.js
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@iursevla
iursevla / static_server.js
Created Nov 21, 2015 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
View static_server.js
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);