Skip to content

Instantly share code, notes, and snippets.

View o0101's full-sized avatar
🏖️
Netscaping

Cris o0101

🏖️
Netscaping
View GitHub Profile
@o0101
o0101 / cracklepop.js
Created October 14, 2017 13:14
Crackle Pop
// javascript (tested in Chrome 61)
// also here: https://runkit.com/dosyago-coder-0/cracklepop
(new Array(8)).join('///Crackle//Pop/Crackle///Crackle/Pop//Crackle///CracklePop')
.split(/\//g).slice(0,101).forEach((print,number) => number > 0 ? console.log(`${number}: ${print}`) : '');
@o0101
o0101 / sketch.js
Last active October 17, 2017 12:00
Text matching in adversarial conditions.
/**
Idea is we want to "attach" something ( annotation, edit, image, link, whatever )
to a particular piece of text that is not necessarily defined by an element.
In other words, some free form text. Whether this text comes from HTML, or a text file
is unimportant. The point is to find this attachment point even when:
- the order of paragraphs is altered
- the order of sentences in a paragraph is altered
- the order of words in a sentence is altered
And we would like to still find the attachment point with high probability when:
@o0101
o0101 / kvdb.js
Last active October 26, 2017 10:38
key-value-datastore
/** see a live demo here: https://runkit.io/dosyago-coder-0/kvdb/branches/master **/
const express = require("express");
const bodyParser = require("body-parser");
const db = new Map();
const page = () => `
<!DOCTYPE html>
<meta charset=utf-8>
const dc = require("dosycrypt");
const page = ({message:message = ''}={}) => `
<title>DOSYCRYPT</title>
<meta name=viewport content="width=device-width, initial-scale=1">
<style>
:root, body, input, textarea, button {
background: orange; color: white;
}
</style>
@o0101
o0101 / index.js
Last active March 6, 2018 04:39
requirebin sketch
const dc = require("dosycrypt");
self.dc = dc;
const page = ({message:message = ''}={}) => `
<title>DOSYCRYPT</title>
<meta name=viewport content="width=device-width, initial-scale=1">
<style>
:root, body, input, textarea, button {
background: orange; color: white;
}
@o0101
o0101 / index.js
Created October 25, 2017 09:31
requirebin sketch
"use strict";
{
const doc = document.implementation.createHTMLDocument('');
let html;
html = document.documentElement.innerHTML;
doc.write(html);
doc.documentElement.setAttribute('xmlns', doc.documentElement.namespaceURI);
html = (new XMLSerializer).serializeToString(doc);
console.log(html);
@o0101
o0101 / domimage.js
Last active November 4, 2017 05:26
(async function (){
try {
const {width,height} = getDOMRect();
const doc = document.implementation.createHTMLDocument('');
doc.write(document.head.outerHTML);
const dom = getSelectedDOMOrBody();
doc.write(dom.outerHTML);
doc.documentElement.setAttribute('xmlns', doc.documentElement.namespaceURI);
const page = `<article id=fantasticprogress style="z-index:1000000000;width:100vw;height:100vh;position: fixed;top:0;left:0;background:rgba(50,50,50,0.5);display:flex;justify-content:center;align-items:center;">
@o0101
o0101 / index.js
Last active November 1, 2017 07:55
requirebin sketch
"use strict";
{
const {get:edit_distance} = require('fast-levenshtein');
const SEN_MARK = {
en: [ ".", "!", "?", "()", "[]" ],
zh: [ "。", "「」", "!", "?", "()", "[]", "【】", "《》", "〈〉"],
es: [ ".", "'", '"', ";", "¡!", "¿?", "“”", "‘’" ],
hi: [ "|", ";", "?", "!", "”" ],
ar: [ ".", "؟", ":", "“”" ]
};
@o0101
o0101 / sketch.js
Created November 1, 2017 15:35
download page html
"use strict";
{
const page = document.documentElement.outerHTML;
const pageBlob = new Blob([page]);
const objectURL = URL.createObjectURL(pageBlob);
const anchor = document.createElement('a');
anchor.target = "_new";
anchor.setAttribute('download','page.html');
anchor.href = objectURL;
anchor.innerText = 'download page.html';
// i want to create something viral
// and interesting
// for other developers to do and get behind
// people don't need frameworks - we have enough
// we don't need prop formats, such as b64, etc
// we have enough
// what if i mix both?
// a framework, a website, a delivery system in a format?