Skip to content

Instantly share code, notes, and snippets.

View idmontie's full-sized avatar

Ivan Montiel idmontie

View GitHub Profile
@idmontie
idmontie / long-polling.jquery.js
Created September 14, 2015 03:39
Long Polling for jQuery
/* Long Polling
*
* By: Ivan Montiel
*/
jQuery.poll = function (options, poll) {
if ( poll == null || poll === undefined) {
poll = {};
}
@idmontie
idmontie / jasmine-phaser-matcher.js
Created September 14, 2015 22:46
Jasmine Phaser Matcher
this.game.stage.children <-- array of objects
this.game.stage.children[0] <-- object with children as array of object
this.game.stage.children[0].children <--- array of objects
expect( this.game.stage ).has( Phaser.TEXT ).withText( 'Take That, Robot!' );
expect( this.game.stage ).has( Phaser.BUTTON ).has( 'text' ).withText( 'Play' );
@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
@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 / 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 / file.txt
Created January 21, 2015 16:53
Github for Windows failing
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 4.0.30319.18444
System.Deployment.dll : 4.0.30319.34244 built by: FX452RTMGDR
clr.dll : 4.0.30319.18444 built by: FX451RTMGDR
dfdll.dll : 4.0.30319.34244 built by: FX452RTMGDR
dfshim.dll : 4.0.41209.0 (Main.041209-0000)
SOURCES
Deployment url : http://github-windows.s3.amazonaws.com/GitHub.application
// 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 / 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

@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);
};