Skip to content

Instantly share code, notes, and snippets.

View particle4dev's full-sized avatar
👨‍💻
Building

Nam Hoang particle4dev

👨‍💻
Building
View GitHub Profile
@particle4dev
particle4dev / effective-es6.md
Last active September 15, 2015 18:00 — forked from rauchg/effective-es6.md
Writing ES6 today, effectively.

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.

The main tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on:

@particle4dev
particle4dev / playerSave.js
Created May 27, 2015 08:19
PlayerSave - phaser plugin
"use strict";
/**
* Class PlayerSave. Load and Manages the save data for the player.
*
* @class PlayerSave
* @namespace Phaser.Plugin
* @constructor
* @param {Phaser.Game} game
* @param {Phaser.Group} parent
@particle4dev
particle4dev / main.js
Last active August 29, 2015 14:21
html-game
"use strict";
var Cloud = function(_level, _spritesheet) {
Phaser.Sprite.call(this, _level.game, 0, 0, _spritesheet), _level.game.add.existing(this), this.level = _level, this.anchor.setTo(.5, .5), this.anglePos = 0, this.angleRad = 0, this.ySky = 0, this.planet = _level.planet, this.direction = 1, this.speed = .001
};
Cloud.prototype = Object.create(Phaser.Sprite.prototype), Cloud.prototype.constructor = Cloud, Cloud.prototype.update = function() {
var planetScale = this.planet.scale.x;
this.scale.setTo(planetScale, planetScale), this.anglePos += this.direction * this.speed * this.level.game.time.elapsed, this.angleRad = this.anglePos * (3.14159 / 180);
var realRadius = .5 * this.planet.width + .5 * this.height - 15 * planetScale;
realRadius += this.ySky * planetScale, this.x = this.planet.x + realRadius * Math.cos(this.angleRad), this.y = this.planet.y + realRadius * Math.sin(this.angleRad), this.angle = this.anglePos + 90
};
@particle4dev
particle4dev / Sizes.md
Last active August 29, 2015 14:18 — forked from jperl/Sizes.md

###Icons

Name Size
iphone_2x 120x120
iphone_3x 180x180
ipad 76x76
ipad_2x 152x152
android_ldpi 36x36
android_mdpi 48x48
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
@particle4dev
particle4dev / protected.js
Last active December 14, 2015 08:59
How to implement protected properties in javascript [ES5]
/**
* How to implement protected properties in javascript [ES5]
*
* @author Steve Hoang <particles4dev>
* @version
* @since 0.1
* @inspiration WebReflection <link>
*
**/
var impose = function(object, func, args){
return func.apply(object, args);
}
var LoopSomething = (function(){
/**
* Define class
*
* @author Steve Hoang <particles4dev>
* @version