Skip to content

Instantly share code, notes, and snippets.

Patrik Johnson orbitbot

  • Helsinki, Finland
Block or report user

Report or block orbitbot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Flems for mithril blog testing
https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcIC2SB0ALeGUIANCAGYCWMYaA2qAHYCGGEamO+hJIsA9g0SD2AYgAEATQhNcxMQEkxSPmPi4m8MQHcKasRgCeYsPACuABwpIGEMGGwAdBk4BUYgLJ8+TsWIC0YgBytohIYlAUJr4+-qq4EGKUAE5Rpgx8SUgQScjhkZpMZIhJcQnJUbgAjNpUUGJMpvB8GBoUsExQUEYA5hCaGHwAbrlNpcZWEE5OgXxyfGRi-KYpCenw2AqaWkxggGQEYqa4++YZ6RtSMnJqGgDkYGK6GwDSVvfqw2LMrGAA-JJ8pkWTAYxggCVwfC0CjywzCACMIGQMglFKxNAYARsAGIUD4Q5a-MQAQS0chaDAAhGIAMIAqDWG7ogFiABWpiivX6CTUCSyGlwYnMEGYUHgBj+AAVgWADI5nAwAAZKllMQY7WBJCjmeBOCgYE5JTQqMhJZpiBwgPhgIWwC1TBh6g2aC3YAD0SL42BZYDtDv1GWdIDdcKYSS9PpATldrrEfVgcqcnqSaQAFABKJxKhX2+SaZS2BiM8JeADWxhUYFwFAYRlGrA28jAhc0ulUye56iZgPeCQRwsFTCsiQyYgxy1UIT1AnFYixSQMci04NVCSYiySGm5KiyEWGYbEAHV5IEACLueQAGQvAGUxCeAPJBe8AFUP94ASk8xM+ABJE18HkSEhUgA4ve94nkE8ggT+z5UgA+vB15NOYFKIWILgngIRaVl4mjJAkJhtGW1bGOYTCwAk7TpBAFJuNSDSQLGAAe5hQFauK8nAzTmDkdgUAIFL2iI4gSMy1GguCkLQruuQIkiOTQmio6YvaDEgoo7Idgk3RpH8ihIFYzb1GAZYKfUiw8TAiBdGIOQ7AITBwjALGwFpVKKDsJa5GOqgqJyYhwuyBhUge0BQFc6gMCW9yjDyCiCNkNjwHI8g3BgnzSXCyJhDoeiQMxDaxfEilrmxFEJAIYxLnCcQaAODBZCkfn6EYUDsvhI6DA
@orbitbot
orbitbot / lenses-chat.txt
Last active Mar 15, 2017
the Mithril dialogues - insightful exchanges in the chatroom
View lenses-chat.txt
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 Jan 11, 2017
Set object property util, for convenience with mithril.js m.withAttr
View utils.js
const set = (obj, prop, modify = (v) => v) => (value) => obj[prop] = modify(value)
exports default set
@orbitbot
orbitbot / http.js
Last active May 26, 2017
Ergonomic Mithril.js 1.x requests
View http.js
// 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 Aug 4, 2016 — forked from WreckedAvent/breadcrumbs.js
basic data flow example
View breadcrumbs.js
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
GH Pages SPA hack
View 404.html
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 Nov 15, 2015
karma-electron-launcher issue with require
View .gitignore
node_modules
@orbitbot
orbitbot / .gitignore
Last active Nov 9, 2015
karma-electron-launcher require fails example
View .gitignore
node_modules
@orbitbot
orbitbot / app.js
Created Oct 31, 2015 — forked from ilsenem/app.js
Mithril Dependency Injector #.editorconfig
View app.js
// 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 Oct 30, 2015
Autoload js script stored in localStorage
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Autoloader</title>
</head>
<body>
<script>
You can’t perform that action at this time.