Skip to content

Instantly share code, notes, and snippets.

View idmontie's full-sized avatar

Ivan Montiel idmontie

View GitHub Profile
@idmontie
idmontie / Reiss User Stories.md
Created March 17, 2018 05:30
User stories, but focused on meeting Reiss desires

As a <role>, I want <something> so that <Reiss desire is met>.

  • Power – I can feel powerful and meet my goals.
  • Curiosity – I can gain understanding of the world around me.
  • Independence – I can make choices that are meaningful to me and explore possibilities about myself.
  • Status – I feel like I am an important person.
  • Social contact – I can connect with others.
  • Vengeance – I can compete against others.
  • Honor – I can feel reliable.
  • Idealism – I can help others and improve their situation.
@idmontie
idmontie / thenable.js
Created March 16, 2018 22:14
Promises with thenable objects
function thenable(value) {
return {
then: function (onfulfill, onreject) {
onfulfill(value);
};
};
}
const promise = Promise.resolve(thenable('voila!'));
@idmontie
idmontie / settled.js
Created March 16, 2018 22:08
Like Promise.all, but it doesn't fail if one of the promises fails.
function settled(promises) {
const alwaysFulfilled = promises.map((p) => {
return p.then((value) => {
return { state: 'fulfilled', value: value };
}, (reason) => {
return { state: 'rejected', reason: reason };
});
});
return Promise.all(alwaysFulfilled);
};
@idmontie
idmontie / mixing_recordings.md
Created November 16, 2017 01:05 — forked from ktoraskartwilio/mixing_recordings.md
Mixing Recordings

When mixing the tracks, we need to consider that they might (and probably have) started at different times. If we were to merge tracks without taking this into account, we would end up with synchronization issues. In our example, since Bob got in the room a good 20s (and that’s really a huge time for synchronization of audios), mixing both Alice’s and Bob’s audio tracks together would end up having one speaking over the other.

To make merging easier, the start time of all tracks from the same room is the creation of the room itself. Let’s get the start times for all the tracks from this room

Get Alice's audio start time

// Usage as a Component
import React, { Component } from 'react';
import Feature from 'react-feature-flags/components';
import { MY_FEATURE_FLAG } from '../flags/constants';
export default class MyComponent extends Component {
render() {
return (
@idmontie
idmontie / inject.js
Created June 6, 2016 21:55
Simple function injection
export default function inject() {
const args = [...arguments];
const toCall = args[0];
const toInject = args.slice(1, args.length);
const shouldInject = inject.should === false ? false : true;
if (shouldInject) {
return function () {
const combinedArgs = [...toInject, ...arguments];
@idmontie
idmontie / SimpleLoanCalculator.md
Last active July 11, 2020 18:28
Simple Loan Calculator

Simple loan calulator, just run in the browser

@idmontie
idmontie / _README.md
Created February 22, 2016 15:18
It's like x for y

It's like X for Y generator

@idmontie
idmontie / !meteor-demo.md
Last active January 6, 2016 17:24
Meteor Demonstration

Demonstration files for Meteor.

@idmontie
idmontie / ideas-for-global-game-jam.md
Last active January 30, 2016 06:21
Ideas for Global Game Jam