Skip to content

Instantly share code, notes, and snippets.

/** very simple spreadsheet idea. try 1 **/
function link(cell, transform) {
let el;
return R`
${key:cell.key}
<td class=cell>
<input bond=${e => el = e} input=${el.value = transform(el.value)}>
</td>
`;
@o0101
o0101 / memory.json
Last active August 28, 2020 10:28
[gistbarn][crislin2046][memory]
{
"followers": [
{
"login": "rubys",
"id": 4815,
"node_id": "MDQ6VXNlcjQ4MTU=",
"avatar_url": "https://avatars1.githubusercontent.com/u/4815?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/rubys",
"html_url": "https://github.com/rubys",
@o0101
o0101 / todo.md
Last active August 28, 2020 10:28
rw todo november 7 2018

Today

  • Test WCE
    • ISSUE with creating a user locally on API / DB to allow testing.
    • Get an access token for the DB.
    • Test API can sort channels by these fields (maybe use API explorer)
    • update UI defaults (the defaults in API have already been updated) for channel to have platform: stb and group: leads and subscribers, when no data for platform and UG (say, old channel) is provided by API.
    • Test API can sort channels by these fields (maybe use API explorer)

Yesterday

@o0101
o0101 / tester.js
Created November 5, 2018 10:32 — forked from freedmand/tester.js
JavaScript unit testing in under 30 lines
const PASS = ['32']; // green
const FAIL = ['31', '1']; // red, bold
function logStyle(ansiEscapeCodes, text) {
console.log(`\x1b[${ansiEscapeCodes.join(';')}m${text}\x1b[0m`);
}
class Tester {
constructor() {}
run();
async function run() {
const orders = await getOrders('http://files.olo.com/pizzas.json');
const orderCounts = countOrders(orders);
const topOrders = sortCounts(orderCounts).slice(0,20);
console.log(JSON.stringify({topOrders},null,2));
}
async function getOrders(url) {

// Make an "icon font" / CSS sheet that I can use for icons, and make it the ONLY icons I use in all my apps // and use "the symbolism"

Owl - 🦉

Hexagon - ⬢

Circle star - ۞

Symbol 1 - ࿃

Symbol 2 - ࿋

@o0101
o0101 / state.md
Last active August 28, 2020 10:29

Ideas:

// state is just objects, but what are changes to state?
// probably also just objects
// but what is the easiest way to "change state"
// let's look at the different types of state
// an object is just a map of keys to values
// a key is a string (without loss of generality)
// generate a random unique code that has ~ 51 bits of entropy
function randid({int:int=false}={}) {
const randInt = Math.round((Math.random()*performance.now()*(+ new Date))/1000);
if ( !! int ) return randInt;
else return randInt.toString(36);
}
// generate a sequence of keys (that throws at MAX_SAFE_INTEGER, roughly ~53 bits)
function *nextkey(prefix = '') {
let count = 1;
@o0101
o0101 / pseudo_elements.md
Created September 6, 2018 14:33 — forked from p3t3r67x0/pseudo_elements.md
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
#include <map>
#include <limits>
template<typename K, typename V>
class interval_map {
std::map<K,V> m_map;
public:
// constructor associates whole range of K with val by inserting (K_min, val)
// into the map