Skip to content

Instantly share code, notes, and snippets.

View glaucopater's full-sized avatar
:octocat:
...

Glauco Pater glaucopater

:octocat:
...
View GitHub Profile
const test_cwd = bru.cwd()
console.log(test_cwd);
const fs = require('fs');
const path = require('path');
if (typeof btoa === 'undefined') {
global.btoa = (str) => Buffer.from(str, 'binary').toString('base64');
}
@glaucopater
glaucopater / 500px.json
Last active August 10, 2020 11:06
500px stats data
[
{
"id": 1020044904,
"created_at": "2020-08-09T16:53:24+00:00",
"privacy": false,
"profile": true,
"url": "/photo/1020044904/Piano-lessons-by-Glauco-Pater",
"user_id": 271978,
"status": 1,
"width": 2048,
@glaucopater
glaucopater / dynamic.html
Created October 8, 2019 19:54
Benchmark static vs dynamic html
<html>
<body>
<script>
const vals = Array.from(Array(100000).keys());
const s = 'All work and no play makes Jack a dull boy';
let content = "";
vals.forEach((elem, index) => {
content += `<div>${index}: ${s}</div>`;
});
{"lastUpload":"2019-08-05T08:50:12.344Z","extensionVersion":"v3.2.9"}
@glaucopater
glaucopater / hero-content-and-list-of-articles.markdown
Created July 28, 2019 09:02
Hero Content and List of Articles
@glaucopater
glaucopater / findRawTextInsideComponents.js
Last active June 30, 2019 15:46
Find Raw Text inside Components
const fs = require("fs");
const glob = require("glob");
const MAX_FILES = 100000;
const regex = />(.*?)</g;
const resultFile = "results.json";
const appPath =
"./app";
function parseInput(str) {
@glaucopater
glaucopater / extract-svg.js
Created May 27, 2019 20:20
Extract SVG from file (Node JS)
var fs = require('fs');
const path = 'MyFile.js';
const svgList= [];
fs. readFile(path, 'utf8', function(err, contents) {
const end_tokens = contents.split("</Svg>");
end_tokens.map(token => {
svgList.push(token.split("<Svg ")[1])
});
@glaucopater
glaucopater / server.js
Created March 29, 2019 15:43
Node JS Web Server
//npm install connect serve-static
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8081, function(){
console.log('Server running on 8081...');
});