Skip to content

Instantly share code, notes, and snippets.

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
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
View range.js
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;
}
View Pinephone Wishlist.md

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 Feb 19, 2019
Hyperapp with dev middleware
View hyperapp.dev.js
(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 Feb 18, 2019
Hyperapp with dev middleware
View hyperapp..dev.js
(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 Feb 17, 2019
Hyperapp base, minified, and dev builds
View hyperapp.dev.js
(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
View Tokenizer.js
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 Jun 29, 2018
A tight functional-reactive update loop for Node.JS, inspired by Elm, Hyperapp, and Redux
View app.js
const nodeEnv = {
defer: (fn) => process.nextTick(fn),
};
const browserEnv = {
defer: (fn) => setTimeout(fn, 0),
};
const create = (update, subscriptions = [], env = browserEnv) => {
let state = update(undefined, {});
View gist:54cfb3e99b65969386c1
### 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 Aug 29, 2015
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
View theButton_helper.js
(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'