Skip to content

Instantly share code, notes, and snippets.

Philippe elsassph

Block or report user

Report or block elsassph

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@elsassph
elsassph / minify-all.js
Created Mar 16, 2018
Run uglify-js on all the javascript files in a folder
View minify-all.js
// NOTE: run with `NODE_ENV=production` for optimal results
const fs = require('fs');
const path = require('path');
const UglifyJS = require('uglify-js');
// Path to process
const bin = './bin';
function onlyJS(files) {
@elsassph
elsassph / 0-readme.md
Last active Aug 30, 2016
Nginx single-page app local dev server config
View 0-readme.md

Easy single-page app dev using nginx

If you're using only nginx (no Apache thx) and want to serve your projects using a local dev domain.

Install nginx

brew install nginx

Or download/unzip for Win: http://nginx.org/en/docs/windows.html

@elsassph
elsassph / ResourceGenerator.hx
Created Jul 3, 2016
Haxe build macro converting a JSON file into strongly typed, inline/dce friendly, properties
View ResourceGenerator.hx
package;
#if macro
import haxe.Json;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
import sys.io.File;
import sys.FileSystem;
@elsassph
elsassph / 0_Test.hx
Last active Nov 26, 2017
Haxe macro for: custom, automatic, getter/setter generation
View 0_Test.hx
/*
We want to generate:
- getMyProperty / setMyProperty
- getAnotherProperty
- getYetAnotherProperty / setYetAnotherProperty
*/
class Test implements Proxied
{
public var MyPoperty(default, default):Int;
@elsassph
elsassph / 0-Example.hx
Last active May 25, 2016
Haxe - use macro to generate dispatch code
View 0-Example.hx
/*
Automatically generate dispatch functions as:
public function onDoubleArguments(one:String, two:Int) {
for (listener in listeners)
listener.onDoubleArguments(one, two);
}
*/
class Example extends Dispatcher<Dynamic>
{
@elsassph
elsassph / 1-loop-es6.js
Last active Dec 5, 2016
ES2015 / babel vs Haxe code generation
View 1-loop-es6.js
const a = [1,2,3];
var acc = 0;
for (const v of a) {
acc += v;
}
// want clean code? use Array.reduce
console.log(acc);
View poop.js
Array.prototype.poop = function() {
this.pop();
// return nothing, it's poop
}
Array.prototype.shit = function() {
this.shift();
// return nothing, it's poop
}
@elsassph
elsassph / Module1.hx
Last active Dec 29, 2015
One approach to building Haxe JS modules - EDIT: see https://github.com/elsassph/modular-haxe-example
View Module1.hx
package modules;
class Module1
{
static public function main()
{
trace("Module1 is loaded");
var m1 = new Module1();
}
@elsassph
elsassph / index.php
Last active Aug 29, 2015
Create a VoiceChatAPI room from Slack
View index.php
<?php
// first create a new voice chat room:
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query(array()),
)
@elsassph
elsassph / SkyboxLite.as
Created Sep 6, 2012
Sample Away3D Lite Stage3DRenderer
View SkyboxLite.as
package
{
import away3dlite.containers.View3D;
import away3dlite.core.render.Renderer;
import away3dlite.core.render.Stage3DRenderer;
import away3dlite.events.MouseEvent3D;
import away3dlite.materials.BitmapMaterial;
import away3dlite.primitives.Plane;
import away3dlite.primitives.Skybox6;
import flash.display.Shape;
You can’t perform that action at this time.