Skip to content

Instantly share code, notes, and snippets.

Janne Siera jannesiera

Block or report user

Report or block jannesiera

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 isStarScorable.ts
// TODO use .flat() or .flatten() instead, but not in this version of JS yet?
flatten(arrays) {
return [].concat.apply([], arrays);
isScorable(posAllStars: number [] [], colors: number []) {
const starColor = colors[0];
// Check for every star and collect the results
return this.flatten(
jannesiera / vuex_orm_graph.js
Last active May 19, 2018
Example API for an ORM for Vuex (graph-like/inspired)
View vuex_orm_graph.js
/* New test relational (graph-like) db */
// NOTE: Relationships are like *arrows* from one entity to another, they are directed (the relationship is defined on the target entity)
// and *always* many-to-many. If you want a one-to-many relationship, make sure you just add one *arrow* and always take the first().
// Demo Structure of state
const s = {
db: {
posts: {
View SAM - acceptors.js
const acceptor = (predicate, mutation) => ({
predicate: predicate,
mutation: mutation
export const createModel = update => {
const acceptors = [
proposal => === `precipitations`,
proposal => update(model => {
View Programming Challenge - Extract Functional Requirements for these two (identical) pieces of code.js
In this file are two code samples. They both implement the exact same functional requirements but in a different way.
Your challenge? Write a description of what this piece of software does.
Why? I would like to know which piece of code you find easier to grasp. What can you tell me about each snippet?
/* SNIPPET 1 */
var view = {
jannesiera / factoring_event_handlers.js
Last active Nov 29, 2018
Breaking down Event Handlers: Decoupling AppState updating and View updating
View factoring_event_handlers.js
// There is one screen. On this screen there are two counters displayed: "counterA" and "counterB"
// There are also two buttons: "buttonA" and "buttonAB"
// Desired behaviour:
// Clicking on buttonA will increment counterA by 1.
// Clicking on buttonAB will increment both counterA by 1 and counterB by 1.
// The code here starts with a 'basic' implementation of one would go about this and
// then proceeds to try and factor the event handlers to a more reusable and maintainable structure.
You can’t perform that action at this time.