Skip to content

Instantly share code, notes, and snippets.

View orbitbot's full-sized avatar

Patrik Johnson orbitbot

  • Helsinki, Finland
View GitHub Profile
https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcIC2SB0ALeGUIANCAGYCWMYaA2qAHYCGGEamO+hJIsA9g0SD2AYgAEATQhNcxMQEkxSPmPi4m8MQHcKasRgCeYsPACuABwpIGEMGGwAdBk4BUYgLJ8+TsWIC0YgBytohIYlAUJr4+-qq4EGKUAE5Rpgx8SUgQScjhkZpMZIhJcQnJUbgAjNpUUGJMpvB8GBoUsExQUEYA5hCaGHwAbrlNpcZWEE5OgXxyfGRi-KYpCenw2AqaWkxggGQEYqa4++YZ6RtSMnJqGgDkYGK6GwDSVvfqw2LMrGAA-JJ8pkWTAYxggCVwfC0CjywzCACMIGQMglFKxNAYARsAGIUD4Q5a-MQAQS0chaDAAhGIAMIAqDWG7ogFiABWpiivX6CTUCSyGlwYnMEGYUHgBj+AAVgWADI5nAwAAZKllMQY7WBJCjmeBOCgYE5JTQqMhJZpiBwgPhgIWwC1TBh6g2aC3YAD0SL42BZYDtDv1GWdIDdcKYSS9PpATldrrEfVgcqcnqSaQAFABKJxKhX2+SaZS2BiM8JeADWxhUYFwFAYRlGrA28jAhc0ulUye56iZgPeCQRwsFTCsiQyYgxy1UIT1AnFYixSQMci04NVCSYiySGm5KiyEWGYbEAHV5IEACLueQAGQvAGUxCeAPJBe8AFUP94ASk8xM+ABJE18HkSEhUgA4ve94nkE8ggT+z5UgA+vB15NOYFKIWILgngIRaVl4mjJAkJhtGW1bGOYTCwAk7TpBAFJuNSDSQLGAAe5hQFauK8nAzTmDkdgUAIFL2iI4gSMy1GguCkLQruuQIkiOTQmio6YvaDEgoo7Idgk3RpH8ihIFYzb1GAZYKfUiw8TAiBdGIOQ7AITBwjALGwFpVKKDsJa5GOqgqJyYhwuyBhUge0BQFc6gMCW9yjDyCiCNkNjwHI8g3BgnzSXCyJhDoeiQMxDaxfEilrmxFEJAIYxLnCcQaAODBZCkfn6EYUDsvhI6DA
@orbitbot
orbitbot / lenses-chat.txt
Last active March 15, 2017 09:28
the Mithril dialogues - insightful exchanges in the chatroom
dontwork @dontwork Feb 07 12:22
export function getUserFormData() {
var form = Object.assign({}, store.getState().users.form)
return form
}
that should return a copy of the form object right
Magnus Leo @magnusleo Feb 07 12:37
Yes.
Object.assign is not available in IE11 if you must support that.
@orbitbot
orbitbot / utils.js
Created January 11, 2017 21:44
Set object property util, for convenience with mithril.js m.withAttr
const set = (obj, prop, modify = (v) => v) => (value) => obj[prop] = modify(value)
exports default set
@orbitbot
orbitbot / http.js
Last active May 26, 2017 21:17
Ergonomic Mithril.js 1.x requests
// GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS
// data becomes querystring on GET requests
class Http {
constructor() {
let methods = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options']
methods.forEach((method) => {
this[method] = (url, data, opts) => m.request(Object.assign({ method, url, data }, opts, this.eval(), this.defaults))
})
}
@orbitbot
orbitbot / breadcrumbs.js
Created August 4, 2016 15:01 — forked from WreckedAvent/breadcrumbs.js
basic data flow example
import * as m from 'mithril'
// this is a "presentation" component and knows nothing about the world
export const view = (_, { link }) => m('.nav', m('.breadcrumbs', [
m('a', { href: link })
]))
@orbitbot
orbitbot / 404.html
Created May 14, 2016 11:42
GH Pages SPA hack
http://www.backalleycoder.com/2016/05/13/sghpa-the-single-page-app-hack-for-github-pages/
<script>
sessionStorage.redirect = location.href;
</script>
<meta http-equiv="refresh" content="0;URL='http://MY_PROJECT_HERE.github.io'"></meta>
@orbitbot
orbitbot / .gitignore
Last active November 15, 2015 19:22
karma-electron-launcher issue with require
node_modules
@orbitbot
orbitbot / .gitignore
Last active November 9, 2015 21:21
karma-electron-launcher require fails example
node_modules
@orbitbot
orbitbot / app.js
Created October 31, 2015 10:20 — forked from ilsenem/app.js
Mithril Dependency Injector #.editorconfig
// Example
// app.js
document.addEventListener("DOMContentLoaded", function (e) {
m.route.mode = "hash";
m.route(document.getElementById("application"), "/", {
"/": m.resolve("pages.home"),
"/findus": m.resolve("pages.findus")
});
});
@orbitbot
orbitbot / index.html
Created October 30, 2015 20:08
Autoload js script stored in localStorage
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Autoloader</title>
</head>
<body>
<script>