Skip to content

Instantly share code, notes, and snippets.

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

Nam Hoang particle4dev

👨‍💻
Building
View GitHub Profile
var impose = function(object, func, args){
return func.apply(object, args);
}
var LoopSomething = (function(){
/**
* Define class
*
* @author Steve Hoang <particles4dev>
* @version
@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>
*
**/
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
@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
@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 / 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 / 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:

#!/bin/bash
# <author mail="particle4dev@gmail.com" />
quotes=(
[0]="Talk is cheap. Show me the code."
[1]="Software is like sex: it's better when it's free."
[2]="I’d like to be a nice person and curse less and encourage people to grow rather than telling them they are idiots. I’m sorry - I tried, it’s just not in me,"
)
length=${#quotes[@]}
@particle4dev
particle4dev / image-proxy.conf
Created October 28, 2015 19:09 — forked from tmaiaroto/image-proxy.conf
Nginx Image Filter Resize Proxy Service
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.