Skip to content

Instantly share code, notes, and snippets.

View mrozbarry's full-sized avatar
🥰
Always supporting learning and good work

Alex Barry mrozbarry

🥰
Always supporting learning and good work
View GitHub Profile
@mrozbarry
mrozbarry / range.js
Created May 20, 2021 21:09
A friend of mine was really _taken_ by Haskell's `take <count> 1..5` functionality, and while there were naysayers, I said it could be duplicated in javascript with generators. Here it is, in all of it's glory
function *makeNumbers(numberStep = 1, startAt = 0) {
for(number = startAt; ; number += numberStep) yield number;
}
export class Range {
constructor(start = 0, end = 0, step = 1) {
this._from = start;
this._to = end;
this._step = step;
}

Wishlist

  • No flashy UI/animations - there is a different between good UI and flashy UI, though.
  • Virtual desktops that can be swiped between
  • Apps to manage configuration / low effort configuration - I'd prefer that I don't need to drop to vim to edit stuff
  • Easy to install new software
  • Easy to save web pages as apps
    • Need to work offline if possible
  • Easy to search apps
  • Swipe keyboard
@mrozbarry
mrozbarry / hyperapp.dev.js
Last active February 19, 2019 02:26
Hyperapp with dev middleware
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.hyperapp = {})));
}(this, (function (exports) { 'use strict';
var merge = function(a, b) {
var target = {};
for (var i in a) target[i] = a[i];
@mrozbarry
mrozbarry / hyperapp..dev.js
Created February 18, 2019 18:59
Hyperapp with dev middleware
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.hyperapp = {})));
}(this, (function (exports) { 'use strict';
var merge = function(a, b) {
var target = {};
for (var i in a) target[i] = a[i];
@mrozbarry
mrozbarry / hyperapp.dev.js
Created February 17, 2019 15:22
Hyperapp base, minified, and dev builds
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.hyperapp = {})));
}(this, (function (exports) { 'use strict';
var DEFAULT = 0;
var RECYCLED_NODE = 1;
var TEXT_NODE = 3; // Node.TEXT_NODE
@mrozbarry
mrozbarry / Tokenizer.js
Created October 15, 2018 13:27
String tokenizer
class Tokenizer {
static empty() {
return new Tokenizer('text', []);
}
static default() {
return Tokenizer.empty()
.mapToType(Tokenizer.presets.link, 'link')
.mapToType(Tokenizer.presets.mention, 'mention');
}
@mrozbarry
mrozbarry / app.js
Last active June 29, 2018 19:03
A tight functional-reactive update loop for Node.JS, inspired by Elm, Hyperapp, and Redux
const nodeEnv = {
defer: (fn) => process.nextTick(fn),
};
const browserEnv = {
defer: (fn) => setTimeout(fn, 0),
};
const create = (update, subscriptions = [], env = browserEnv) => {
let state = update(undefined, {});
### Keybase proof
I hereby claim:
* I am mrozbarry on github.
* I am mrozbarry (https://keybase.io/mrozbarry) on keybase.
* I have a public key whose fingerprint is CA4E AD3F C307 A607 361E 486D F5E1 95FC 7AAE CAF9
To claim this, I am signing this object:
@mrozbarry
mrozbarry / theButton_helper.js
Last active August 29, 2015 14:18
A script for connecting to the reddit.com/r/thebutton widget. This script only works while on the /r/thebutton page with the button visible! https://youtu.be/u42V7Re3_2E
(function(){
// Written by Alex Barry April, 2015
// http://mrbarry.com/
// TODO: understanding the wss:// uri
// what is the 'h' param?
/*var params = {
e: M.floor((new Date()).getTime() / 1000),
h: '???need a better hacker here - it appears to be constant through page reloads'