Skip to content

Instantly share code, notes, and snippets.

View rmartone's full-sized avatar

Ray Martone rmartone

  • AirDash Entertainment
  • Washington, DC
View GitHub Profile
@rmartone
rmartone / scratch.js
Created March 2, 2015 14:59
Gulp exceprt to Browserify Typescript with sourcemaps that work with Webstorm’s built-in debugger.
/**
* Browserify Typescript with sourcemaps that Webstorm can use.
* The other secret ingredient is to map the source directory to the
* remote directory through Webstorm's "Edit Configurations" dialog.
*/
'use strict';
var gulp = require('gulp'),
browserify = require('browserify'),
tsify = require('tsify'),
@rmartone
rmartone / compressedTextureAtlas.ts
Last active August 3, 2018 19:55
Simple example using phaser-ce texture atlas with compressed textures
import { Dictionary, ErrorCallback, parallel } from 'async';
import { AnimationParser, Cache } from 'phaser';
import { Client } from './client';
/**
* pending texture atlas 'complete' callbacks
*/
const pending: Dictionary<ErrorCallback<string>> = {};
/**
@rmartone
rmartone / component.js
Last active August 6, 2018 20:14
Excerpt from "Building Multiplayer Board Games with Phaser"
import { guid } from '../shared/stringutils';
import { READONLY_ERR_MSG } from './constants';
/**
* Components add specific behaviors to their GameObjects through composition.
* Components typically span diverse domains from AI and rendering to physics.
* This provides a means for them to coexist within a single entity with
* minimal coupling.
*
* @see GameObject
@rmartone
rmartone / validateSignedPlayerInfo.js
Created September 2, 2019 15:23
Validate signature from FBInstant.player.getSignedPlayerInfoAsync()
const createHmac = require("crypto").createHmac;
const APP_SECRET = "<APP_SECRET>";
/**
* Validates the signature provided by FBInstant.player.getSignedPlayerInfoAsync()
* @param {string} signedPayload returned by getSignature() after
* @returns response payload as a JSON object; otherwise, returns undefined.
* @see https://developers.facebook.com/docs/games/instant-games/sdk/fbinstant6.1/#signedplayerinfo
*/
function validateSignedPlayerInfo(signedPayload) {